java.lang.NoClassDefFoundError:com.amazon.android.Kiwi

时间:2016-04-29 07:44:55

标签: android amazon kindle-fire

我正在为亚马逊Fire平板电脑制作应用。我收到了这个错误。请帮我解决这个错误。谢谢!`

04-26 00:16:59.470: E/AndroidRuntime(29646): FATAL EXCEPTION: main
04-26 00:16:59.470: E/AndroidRuntime(29646): java.lang.NoClassDefFoundError: com.amazon.android.Kiwi
04-26 00:16:59.470: E/AndroidRuntime(29646):    at com.smartdevs.playtube.Activities.MainActivity.onCreate(MainActivity.java)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.Activity.performCreate(Activity.java:4635)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1999)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2060)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1181)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.os.Looper.loop(Looper.java:137)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at android.app.ActivityThread.main(ActivityThread.java:4558)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at java.lang.reflect.Method.invokeNative(Native Method)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at java.lang.reflect.Method.invoke(Method.java:511)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-26 00:16:59.470: E/AndroidRuntime(29646):    at dalvik.system.NativeStart.main(Native Method)
04-26 00:16:59.595: W/ActivityManager(209):   Force finishing activity com.smartdevs.playtube/.Activities.MainActivity
04-26 00:16:59.595: V/ActivityStack(209): Prepare close transition: finishing ActivityRecord{41e6af50 com.smartdevs.playtube/.Activities.MainActivity}
04-26 00:16:59.681: D/dalvikvm(209): GC_CONCURRENT freed 1738K, 30% free 20462K/28935K, paused 3ms+7ms`

1 个答案:

答案 0 :(得分:1)

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

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

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

3)打开app的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()
    }
}

}