java.lang.NoClassDefFoundError:解析失败:Lcom / amazon / android / Kiwi;

时间:2017-10-06 07:25:45

标签: amazon amazon-fire-tv amazon-appstore

我已在亚马逊应用商店上传了一个FireTV版本,但亚马逊拒绝了该版本。我没有使用任何亚马逊图书馆。我从亚马逊获得的日志

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazon/android/Kiwi;
10-05 02:28:09.323: E/AndroidRuntime(29717):    at com.tv.LeanbackActivity.onCreate(LeanbackActivity.java)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.Activity.performCreate(Activity.java:6010)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2320)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2435)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.ActivityThread.access$800(ActivityThread.java:160)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.os.Handler.dispatchMessage(Handler.java:102)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.os.Looper.loop(Looper.java:135)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at android.app.ActivityThread.main(ActivityThread.java:5483)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at java.lang.reflect.Method.invoke(Native Method)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at java.lang.reflect.Method.invoke(Method.java:372)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
10-05 02:28:09.323: E/AndroidRuntime(29717): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.amazon.android.Kiwi" on path: DexPathList[[zip file "/data/app/air.com.snagfilms-1/base.apk", zip file "/system/priv-app/DeviceMessagingAndroidSDK/DeviceMessagingAndroidSDK.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/data/app/air.com.snagfilms-1/lib/arm, /vendor/lib, /system/lib]]
10-05 02:28:09.323: E/AndroidRuntime(29717):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-05 02:28:09.323: E/AndroidRuntime(29717):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
10-05 02:28:09.323: E/AndroidRuntime(29717):    ... 14 more
10-05 02:28:09.323: E/AndroidRuntime(29717):    Suppressed: java.lang.ClassNotFoundException: com.amazon.android.Kiwi
10-05 02:28:09.323: E/AndroidRuntime(29717):        at java.lang.Class.classForName(Native Method)
10-05 02:28:09.323: E/AndroidRuntime(29717):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
10-05 02:28:09.323: E/AndroidRuntime(29717):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
10-05 02:28:09.323: E/AndroidRuntime(29717):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
10-05 02:28:09.323: E/AndroidRuntime(29717):        ... 15 more
10-05 02:28:09.323: E/AndroidRuntime(29717):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

亚马逊代表说我在我的应用程序中使用ADM(亚马逊设备消息),但我不知道我的清单没有ADM(甚至GCM)的权限。

1 个答案:

答案 0 :(得分:1)

如果启用了multidex,则会发生此错误。要解决此错误,您必须进行一些更改。

1)在App根文件夹中创建文件名multidex.keep

2)在该文件中写下com/amazon/android/Kiwi.class

3)打开应用程序的build.gradle文件,并在android标记中写下以下代码。

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
    preDexLibraries = false
    additionalParameters = ["--set-max-idx-number=55000"] // default 60000
}

4)打开app build.gradle文件并在android标签内写

afterEvaluate {
if (!android.applicationVariants.matching { it.flavorName == 'mobile' }.isEmpty()) {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = []
        }
        dx.additionalParameters += '--multi-dex' // enable multidex
        dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
    }
}

}