我正在为亚马逊Kindle消防设备申请,我在这里使用的信息。 https://developer.amazon.com/sdk/adm.html。我还添加了
amazon-device-messaging-1.0.1.jar
根据指南。我试图在kindle设备上运行,但它已经崩溃了。
02-13 12:02:13.452 25016-25016/com.app.app2158c74aeaa4 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.app2158c74aeaa4, PID: 25016
java.lang.NoClassDefFoundError: com.app.app2158c74aeaa4.ADMMessageHandler
at com.app.app2158c74aeaa4.HomeActivity.kindlePushNotification(HomeActivity.java:215)
at com.app.app2158c74aeaa4.HomeActivity.onCreate(HomeActivity.java:205)
at android.app.Activity.performCreate(Activity.java:6057)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2440)
at android.app.ActivityThread.access$800(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
我正在使用的代码:
try {
startService(new Intent(this, ADMMessageHandler.class));
}
catch (Exception e){
e.printStackTrace();
}
/* Register app with ADM. */
loadUpdatedAppJson();
register();
清单:
<!-- Your application's API Key -->
<meta-data
android:name="AmazonAPIKey"
android:value="@string/api_key" />
<!-- Declare your ADMMessageHandlerBase implementation as a service -->
<service
android:name="com.app.app2158c74aeaa4.ADMMessageHandler"
android:exported="false" />
<!-- You must explicitly enable ADM. You must also declare whether your application will run with or without ADM.
If you specify android:required="false", your app must degrade gracefully when ADM is unavailable. -->
<amazon:enable-feature
android:name="com.amazon.device.messaging"
android:required="true" />
<receiver
android:name="com.app.app2158c74aeaa4.ADMMessageHandler$MessageAlertReceiver"
android:permission="com.amazon.device.messaging.permission.SEND">
<intent-filter>
<action android:name="com.amazon.device.messaging.intent.REGISTRATION" />
<action android:name="com.amazon.device.messaging.intent.RECEIVE" />
<category android:name="com.example.kindleamritesh" />
</intent-filter>
</receiver>
请注意:
第215行是
startService(new Intent(this,ADMMessageHandler.class));