1

我有亚马逊设备消息传递的错误。

在 gradle 中编译:

//compile in gradle
provided files('libs/amazon-device-messaging-1.0.1.jar')

我已经尝试过:

编译文件('libs/amazon-device-messaging-1.0.1.jar')

显现:

<permission android:name="com.bookmark.money.permission.RECEIVE_ADM_MESSAGE"
android:protectionLevel="signature" />

<uses-permission      android:name="com.bookmark.money.permission.RECEIVE_ADM_MESSAGE" />

 <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />

 <application ...>

<amazon:enable-feature
   android:name="com.amazon.device.messaging"
   android:required="true" />

</application>

致电 ADM:

//call adm
ADM adm = new ADM(context); //error inline

在 logcat 中:

E/AndroidRuntime: FATAL EXCEPTION: main
              java.lang.NoClassDefFoundError: com.amazon.device.messaging.ADM
                  at com.zoostudio.moneylover.cloudMessage.CloudMessageHelper.getCloudMessageId(CloudMessageHelper.java:21)
                  at com.zoostudio.moneylover.cloudMessage.CloudMessageHelper.register(CloudMessageHelper.java:14)
                  at com.zoostudio.moneylover.MoneyApplication.createObjectSingleton(MoneyApplication.java:511)
                  at com.zoostudio.moneylover.MoneyApplication.onCreate(MoneyApplication.java:294)
                  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
                  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
                  at android.app.ActivityThread.access$1300(ActivityThread.java:141)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
                  at android.os.Handler.dispatchMessage(Handler.java:99)
                  at android.os.Looper.loop(Looper.java:137)
                  at android.app.ActivityThread.main(ActivityThread.java:5041)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:511)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
                  at dalvik.system.NativeStart.main(Native Method)'

如果您有任何想法,请帮助我!

*更新:

来自亚马逊的 Levon 为我回复。ADM 可以在物理设备(亚马逊或非亚马逊)上运行,但不能工作:(

同样的错误:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazon/device/messaging/ADM;
4

1 回答 1

0

我有同样的问题。问题出在清单中的 xml 命名空间中。

它应该像文档中一样:

xmlns:amazon="http://schemas.amazon.com/apk/res/android"​</p>

于 2018-09-14T12:03:35.207 回答