I have uploaded a FireTV build on amazon app store but Amazon rejected the build . I am not using any amazon library . The logs which i got from Amazon
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
Amazon rep says that I am using ADM (Amazon Device Messaging) in my app but I don't and my manifest has no permissions for ADM (or even GCM for that matter).
This error is happening if you have multidex enabled. For resolving this error you will have to do some changes.
1) Create a file name multidex.keep
in App root folder.
2) Write com/amazon/android/Kiwi.class
in that file.
3) Open app's build.gradle
file and write below code in android
tag.
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
additionalParameters = ["--set-max-idx-number=55000"] // default 60000
}
4) Open app build.gradle file and inside android tag write
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()
}
}
}