Search code examples
androidmergegradleandroid-gradle-pluginandroid-theme

Gradle: Manifest merge changes the value for the "theme" parameters in the AndroidManifest file:


The problem I have is that if I have in the base Manifest file an Acitivity, say like so:

 <activity
        android:name=".activities.ActTutorial"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Holo.NoActionBar"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>

After I merge the manifest files, produce the apk file and open this apk file (using apktool) to look at the AndroidManifest.xml file I see this:

 <activity 
     android:theme="@*android:style/Theme.Holo.NoActionBar" 
     android:label="@string/app_name" 
     android:name=".activities.ActTutorial" 
     android:screenOrientation="portrait">

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

The android:theme value changed from:

"@android:style/Theme.Holo.NoActionBar"

to

"@*android:style/Theme.Holo.NoActionBar"

As you can see there is an asterisk (*) there and this basically result in showing me an activity with ActionBar when in fact I need one without.

Does some one knows why this happens? and this can be fixed?


Solution

  • In the end the asterisk was not my problem for this thing, but I had some problem with the application package names, what helped in this case was to use:

    ${applicationId}. place holder in the manifest file for different packages of the different flavor of the project.

    You can use it like so:

    <permission
                android:name="${applicationId}.permission.C2D_MESSAGE"
                android:protectionLevel="signature"/>
        <uses-permission
                android:name="${applicationId}.permission.C2D_MESSAGE"/>