1

I am having an issue with the naming of the application when the label string comes from an android library in a multi module project.

Here's some code

application/src/main/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest 
  xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.mycompany.android">

  <application
      android:name=".MainApplication"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name">

    <activity
        android:name=".main.MainActivity"
        android:label="@string/app_name">

      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>

      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="mycompany"/>
      </intent-filter>

    </activity>
  </application>
</manifest>

application/src/main/res/values/strings.xml

EMPTY. All application strings are coming from the library.

library/src/main/res/values/strings.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>
  <string name="app_name">MyAppName</string>
  ...
</resources 

Result:

The application is named Library instead of MyAppName in the application launcher once it's installed in any device.

Things I tried/did:

  • Added same label than the application to the activity with android.intent.action.MAIN intent filter
  • Moved @app_name string to application/src/main/res/values/string.xml. This does work, but is not ideal in my case as translations are managed entirely in a different module.
  • The rest of the strings in the application are correctly being picked up from the library
  • Searched for the string Library and I did not find it anywhere in all my code.
  • Suggested by @azizbekian: Added tools:replace="android:label" to both application and main activity manifest tags

Any clues? Thanks in advance.

Community
  • 1
  • 1
Robert Estivill
  • 12,369
  • 8
  • 43
  • 64

0 Answers0