android - Unable to instantiate application: java.lang.ClassNotFoundException: -
the issue occurs if:
i run app android studio , app runs properly
then delete app , tried install debug.apk
.../app/build/outputs/apk/debug.apk
my os ubuntu 16.04, oracle jdk
but on windows 7 works properly(apk can installed .../app/build/outputs/apk/debug.apk
, runs properly)
this error occurs:
fatal exception: main process: com.example, pid: 21084 java.lang.runtimeexception: unable instantiate application com.example.myapp: java.lang.classnotfoundexception: didn't find class "com.example.myapp" on path: dexpathlist[[zip file "/data/app/com.example-1/base.apk"],nativelibrarydirectories=[/data/app/com.example-1/lib/arm, /vendor/lib, /system/lib]] @ android.app.loadedapk.makeapplication(loadedapk.java:676) @ android.app.activitythread.handlebindapplication(activitythread.java:6289) @ android.app.activitythread.access$1800(activitythread.java:221) @ android.app.activitythread$h.handlemessage(activitythread.java:1860) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:158) @ android.app.activitythread.main(activitythread.java:7224) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1230) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1120) caused by: java.lang.classnotfoundexception: didn't find class "com.example.myapp" on path: dexpathlist[[zip file "/data/app/com.example-1/base.apk"],nativelibrarydirectories=[/data/app/com.example-1/lib/arm, /vendor/lib, /system/lib]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:511) @ java.lang.classloader.loadclass(classloader.java:469) @ android.app.instrumentation.newapplication(instrumentation.java:1004) @ android.app.loadedapk.makeapplication(loadedapk.java:666) @ android.app.activitythread.handlebindapplication(activitythread.java:6289) @ android.app.activitythread.access$1800(activitythread.java:221) @ android.app.activitythread$h.handlemessage(activitythread.java:1860) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:158) @ android.app.activitythread.main(activitythread.java:7224) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1230) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1120) suppressed: java.lang.classnotfoundexception: com.example.myapp @ java.lang.class.classforname(native method) @ java.lang.bootclassloader.findclass(classloader.java:781) @ java.lang.bootclassloader.loadclass(classloader.java:841) @ java.lang.classloader.loadclass(classloader.java:504) ... 12 more caused by: java.lang.noclassdeffounderror: class not found using boot class loader; no stack trace available
my gradle:
apply plugin: 'com.android.application' apply plugin: 'me.tatarka.retrolambda' apply plugin: 'io.fabric' apply plugin: 'android-apt' android { compilesdkversion 25 buildtoolsversion "25.0.2" defaultconfig { applicationid "com.example" minsdkversion 19 targetsdkversion 25 versioncode 1 versionname "1.0" multidexenabled true testinstrumentationrunner "android.support.test.runner.androidjunitrunner" jackoptions { enabled false } } compileoptions { sourcecompatibility javaversion.version_1_8 targetcompatibility javaversion.version_1_8 } dexoptions { javamaxheapsize "8g" jumbomode = true predexlibraries = false } signingconfigs { //release release { storefile file("/keys/apk_key.jks") storepassword "apk_key" keyalias "apk_key" keypassword "apk_key" } } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.release debuggable false } debug { signingconfig signingconfigs.release debuggable true } } dexoptions { javamaxheapsize "3g" } packagingoptions { exclude 'license.txt' exclude 'mockito-extensions/org.mockito.plugins.mockmaker' exclude 'meta-inf/dependencies.txt' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' exclude 'meta-inf/notice' exclude 'meta-inf/license' exclude 'meta-inf/dependencies' exclude 'meta-inf/notice.txt' exclude 'meta-inf/license.txt' exclude 'meta-inf/dependencies.txt' }
}
dependencies { compile filetree(dir: 'libs', include: ['*.jar']) ... }
also tried to:
invalidate cache/restart
clean project
rebuild project
thank @dileep patel faced same issue. app worked if it's installed android studio , crashed if it's installed adb command. invalidate caches/restart , disabling instant run(android studio->preferences->instant run, uncheck "enable instance run") worked in case.
Comments
Post a Comment