我刚刚制作了一个通知应用,当我运行它时,它会显示
"清单合并因多个错误而失败,请参阅日志“。
我已经清理并重建了项目。但不行。日志猫太大,所以我不能包含它。
的Manifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:icon"
package="shiweichen22gmail.notification">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="shiweichen22gmail.notification.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission android:name="shiweichen22gmail.notification.permission.C2D_MESSAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label= "@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="shiweichen22gmail.notification"/>
</intent-filter>>
</receiver>
<service android:name=".GCMPushReceiverService" android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<service android:name=".GCMRegistrationIntentService" android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
</application>
</manifest>
答案 0 :(得分:1)
您只需在AndroidManifest.xml中添加此行。
<permission
android:name="your_package.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="your_package.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<receiver
android:name="your_package.NotificationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="your_package" />
</intent-filter>
</receiver>