Manifest Merging with applicationIdSuffix

1,072 views
Skip to first unread message

Ray Hunter

unread,
Jul 30, 2014, 3:02:36 PM7/30/14
to adt...@googlegroups.com
I am wondering if anyone has seen this issue. I have searched on the web, but I have not found anything yet. 

I have the following setup:

------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------

Build time:   2014-04-29 09:24:31 UTC
Build number: none
Revision:     a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy:          2.2.0
JVM:          1.7.0_60 (Oracle Corporation 24.60-b09)
OS:           Mac OS X 10.9.4 x86_64


The following config:

# modified some
def final String PACKAGE_NAME = "com.example.marketing.android"

android {

    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }

    lintOptions {
        abortOnError false
    }

    productFlavors {
        dev {
            applicationId PACKAGE_NAME + ".dev"           
        }
    }

    buildTypes {
        debug {
            ...
            applicationIdSuffix ".debug"
            versionNameSuffix " Debug"
        }

        qa {
            ...
            applicationIdSuffix ".qa"
            versionNameSuffix " QA"
        }

        release {
            ...
        }
    }
}

In the AndroidManifest.xml found under src/main. I am using the placeholder ${applicationId} and I am getting some unexpected results when expanded. I am adding Urban Airship to my project and see issues with the permissions, receiver and provider:

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


So when I build the DevQa build: ./gradlew clean assembleDevQa

I can check the generated apk file with the following command: aapt d permissions marketing/build/outputs/apk/marketing-dev-qa.apk

And get the results:

permission: com.example.marketing.android.dev.qa.dev.qa.richpush.permission.C2D_MESSAGE
uses-permission: com.example.marketing.android.dev.qa.dev.qa.richpush.permission.C2D_MESSAGE
permission: com.example.marketing.android.dev.qa.dev.qa.richpush.permission.UA_DATA
uses-permission: com.example.marketing.android.dev.qa.dev.qa.richpush.permission.UA_DATA


Notice that the "dev.qa" portion of the package is duplicated 2 times.

This does not seem like the correct behavior, but I wanted to verify. I tried searching for bugs along this to see if someone had submitted anything, but did not find anything. Perhaps I missed something?


Thanks,
Ray



Jerome Dochez

unread,
Jul 30, 2014, 5:20:26 PM7/30/14
to adt...@googlegroups.com
this does not seem correct indeed, let me try to reproduce it on my end.

thanks for reporting.
jerome

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jerome Dochez

unread,
Jul 30, 2014, 5:41:06 PM7/30/14
to adt...@googlegroups.com
I cannot reproduce it, this is my set up :

def final String PACKAGE_NAME = "com.android.tests.flavored"

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    testBuildType = "staging"

    defaultConfig {
    }

    productFlavors {
        f1 {
            applicationId = PACKAGE_NAME + ".f1"
            versionName = "1.0.0-f1"
        }
        f2 {
            applicationId = PACKAGE_NAME + ".f2"
            versionName = "1.0.0-f2"
        }
    }

    buildTypes {
        debug {
            applicationIdSuffix = ".debug"
            versionNameSuffix = ".D"
        }
        staging {
            applicationIdSuffix = ".staging"
            versionNameSuffix = ".S"
            signingConfig signingConfigs.debug
        }
    }
}

AndroidManifest.xml in src/main : 

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

and once built i get : 

 ~/oss/adt/sdk/build-tools/android-L/aapt d permissions ./build/outputs/apk/bug-f1-debug.apk

package: com.android.tests.flavored.f1.debug

permission: com.android.tests.flavored.f1.debug.richpush.permission.C2D_MESSAGE

uses-permission: name='com.android.tests.flavored.f1.debug.richpush.permission.C2D_MESSAGE'

permission: com.android.tests.flavored.f1.debug.richpush.permission.UA_DATA

uses-permission: name='com.android.tests.flavored.f1.debug.richpush.permission.UA_DATA'


Can you look in the merged manifest file at 

./build/intermediates/manifests/dev/qa/AndroidManifest.xml

and check the permissions ? are they correct or already mangled ? 

any overlay manifest file in your project ?


To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscribe@googlegroups.com.

Jerome Dochez

unread,
Jul 30, 2014, 5:56:26 PM7/30/14
to adt...@googlegroups.com
which version of the plugin are u using ? the latest is 0.12.2, make sure you use the latest. 

Ray Hunter

unread,
Jul 30, 2014, 6:55:53 PM7/30/14
to adt...@googlegroups.com
I have this in my build script: classpath
'com.android.tools.build:gradle:0.12.+'

So i am hoping that it is pulling 0.12.2. I will try and set it to
0.12.2 manually.

No overlay manifest. I just have the one manifest in the project.

Let me check the other files a little later and post back.
>>>> an email to adt-dev+u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "adt-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/adt-dev/Mp4ObBTpL1M/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> adt-dev+u...@googlegroups.com.

Ray Hunter

unread,
Aug 1, 2014, 4:55:42 PM8/1/14
to adt...@googlegroups.com
Jerome,

The manifest under the intermediates directory is already mangled.

<permission android:name="com.example.marketing.android.dev.qa.dev.qa.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission
android:name="com.example.marketing.android.dev.qa.dev.qa.permission.C2D_MESSAGE"/>
<permission android:name="com.example.marketing.android.dev.qa.dev.qa.permission.UA_DATA"
android:protectionLevel="signature"/>
<uses-permission
android:name="com.example.marketing.android.dev.qa.dev.qa.permission.UA_DATA"/>

...
<receiver android:name="com.urbanairship.push.GCMPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.example.marketing.android.dev.qa.dev.qa"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>

...

<provider android:name="com.urbanairship.UrbanAirshipProvider"
android:authorities="com.example.marketing.android.dev.qa.dev.qa.urbanairship.provider"
android:exported="true" android:multiprocess="true"
android:permission="com.example.marketing.android.dev.qa.permission.UA_DATA"/>


So the provider android:authorities is mangled along with the
intent-fitler category under the receiver.

Is there anything that someone know that would trigger this behavior
that I might be doing?

Ray Hunter

unread,
Aug 1, 2014, 4:57:08 PM8/1/14
to adt...@googlegroups.com
Here is the AndroidManifest provider tag:

<provider android:name="com.urbanairship.UrbanAirshipProvider"
android:authorities="${applicationId}.urbanairship.provider"
android:permission="${applicationId}.permission.UA_DATA"
android:exported="true"
android:multiprocess="true"/>

So I am not sure why the permission is working correctly.

Jerome Dochez

unread,
Aug 1, 2014, 5:01:21 PM8/1/14
to adt...@googlegroups.com
this is really quite funky...

is there any chance you can share the project (or more likely a subset of it) so I could reproduce it on my end ?




>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "adt-dev" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/adt-dev/Mp4ObBTpL1M/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to

>>> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages