我有一个GCM的Android Gradle项目示例。当我添加了两种风味时,推送通知停止工作了。我的编译清单(它来自app\build\intermediates\manifests\ex\debug
)文件如下:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flavor.app"
<uses-permission android:name="com.flavor.app.permission.C2D_MESSAGE" />
<permission
android:name="com.flavor.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
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.flavor.app" />
</intent-filter>
</receiver>
<service android:name="com.ex.app.GCMIntentService" />
<service
android:name="com.ex.app.AppLocationService"
class=".AppLocationService" >
<intent-filter>
<action
android:name=".AppLocationService"
android:value=".AppLocationService" />
</intent-filter>
</service>
我应该怎么做才能解决这个问题?请帮忙。
更新1:我正在使用gradle v.0.12+。我认为我的最终清单文件看起来不错,GCMRegistrar.checkManifest(this);-没有错误,但是GCMRegistrar.isRegistered(this)总是为false。=(
更新2:我的第一个风味项目使用原始包名称(作为主分支中的项目)运行良好,但是更改了包的第二个风味项目无法正常工作(推送的registrationId仍为空),但在清单文件中所有权限都是正确的。