Android GCM with product flavors

I have GCM sample android gradle project. Its worked well, when I add 2 flavors a push notification stopped to work. My compilation manifest (it’s taken from appbuildintermediatesmanifestsexdebug) file is below:

<manifest xmlns:android=""
    <uses-permission android:name="" />

        android:protectionLevel="signature" />

            android:permission="" >
                <action android:name="" />
                <action android:name="" />

                <category android:name="" />

        <service android:name="" />
            class=".AppLocationService" >
                    android:value=".AppLocationService" />

What should I do to fix this problem? Please help.

UPD1. I am using gradle v.0.12+. i think my final manifest file looks good, GCMRegistrar.checkManifest(this); – without errors, but GCMRegistrar.isRegistered(this) always false. =(

UPD2. My first flavor project with original package name (as project in main branch) works well, but second flavor with changed package doesn’t work (registrationId for push is still empty), but in manifest file all permitions are correct.


I found solution in this post GCM not registering when changing package name with Gradle. I just override BroadcastReceiver, if anyone can explain why it helpes please tell me.

Leave a Reply

Your email address will not be published. Required fields are marked *