java - Android MultiDex ClassNotFoundException -
because of large application, have use multidex split app pre lollipop devices. when debugging app on nexus 4 (ics 4.3), following errors.
why classes not found?
defaultconfig { applicationid "de.itout.bring.handsoffme" minsdkversion 17 targetsdkversion 23 versioncode 6 versionname "1.2" multidexenabled true } buildtypes { release { //signingconfig signingconfigs.debug minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.release } debug { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } dexoptions { //javamaxheapsize "512m" //predexlibraries = false javamaxheapsize "4g" incremental true }
dependencies { compile project(':emoji') provided filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:multidex:1.0.1' compile 'com.twitter.sdk.android:twitter:1.12.0' //compile 'com.google.android.gms:play-services-analytics:8.3.0' compile 'com.crashlytics.sdk.android:crashlytics:2.5.5' compile 'com.google.android.gms:play-services:8.3.0' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:cardview-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.1.1' compile 'com.github.satyan:sugar:1.4' compile 'com.loopj.android:android-async-http:1.4.9' compile 'com.path:android-priority-jobqueue:1.1.2' compile 'com.anjlab.android.iab.v3:library:1.0.30' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.facebook.android:facebook-android-sdk:4.9.0' }
public class myapplikation extends sugarapp { @override protected void attachbasecontext(context base) { super.attachbasecontext(base); //multidex.install(getapplicationcontext()); //multidex.install(getbasecontext()); multidex.install(this); }
(edit)
<application android:name=".myapplikation" android:allowbackup="true" android:icon="@mipmap/my_icon" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme" tools:replace="android:icon" >
proguard-rules.pro
-dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -dontoptimize -verbose
fatal exception: main java.lang.runtimeexception: unable instantiate application com.android.tools.fd.runtime.bootstrapapplication: java.lang.classnotfoundexception: didn't find class "com.android.tools.fd.runtime.bootstrapapplication" on path: dexpathlist[[zip file "/data/app/de.itout.bring.handsoffme-2.apk"],nativelibrarydirectories=[/data/app-lib/de.itout.bring.handsoffme-2, /vendor/lib, /system/lib]] @ android.app.loadedapk.makeapplication(loadedapk.java:509) @ android.app.activitythread.handlebindapplication(activitythread.java:4417) @ android.app.activitythread.access$1300(activitythread.java:141) @ android.app.activitythread$h.handlemessage(activitythread.java:1316) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5103) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:525) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) @ dalvik.system.nativestart.main(native method) caused by: java.lang.classnotfoundexception: didn't find class "com.android.tools.fd.runtime.bootstrapapplication" on path: dexpathlist[[zip file "/data/app/de.itout.bring.handsoffme-2.apk"],nativelibrarydirectories=[/data/app-lib/de.itout.bring.handsoffme-2, /vendor/lib, /system/lib]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:53) @ java.lang.classloader.loadclass(classloader.java:501) @ java.lang.classloader.loadclass(classloader.java:461) @ android.app.instrumentation.newapplication(instrumentation.java:975) @ android.app.loadedapk.makeapplication(loadedapk.java:504) @ android.app.activitythread.handlebindapplication(activitythread.java:4417) @ android.app.activitythread.access$1300(activitythread.java:141) @ android.app.activitythread$h.handlemessage(activitythread.java:1316) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5103)
to avoid having multidex @ all, suggest use individual google play services module depending upon exact requirements outlined here.
set minifyenabled
true
, make adjustments proguard entries.
using instant run has problems now. has been reported in link.
Comments
Post a Comment