In Google Play Developer Console I see this crash:
java.lang.RuntimeException: Unable to instantiate application com.example.MyApp: java.lang.ClassNotFoundException: Didn't find class "com.example.MyApp" on path: DexPathList[[zip file "/mnt/asec/com.example.testapp-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.testapp-1/lib, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4545)
at android.app.ActivityThread.access$1500(ActivityThread.java:160)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5330)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.MyApp" on path: DexPathList[[zip file "/mnt/asec/com.example.testapp-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.testapp-1/lib, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
... 11 more
Suppressed: java.io.IOException: unable to open DEX file
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:296)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:263)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:230)
at dalvik.system.DexPathList.<init>(DexPathList.java:112)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:65)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:57)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:326)
at android.app.LoadedApk.makeApplication(LoadedApk.java:508)
... 11 more
This crash occurs mostly on Android versions 4.4 and 4.2.
This answer suggests that this crash occurs when the apk is updated by dalvik. It seems to be a low-priority Android bug.
Are there any workarounds for this?
Does it help to set
<application
android:allowBackup="false"
in Manifest.xml?
(Maybe the backup of application is stored on SD-card, which is causing the problem on apk update).
This error usually occurs when you declare a class extending Application (android.app.Application) and then user android:name="thatClassName"
But if your App can't access it class fully. This error can occur
Try Making the class public only
It will make the application user that class globally
Related
When I install app on the device with the android 4.4 app crashed and I get this error in the logcat.
But app installs and correctly work on the above android.
How can I fix this error
I also add the below code on the manifiests.xml and didn't get any result
<provider
android:name="com.iceteck.silicompressorr.provider.GenericFileProvider"
android:authorities="${applicationId}.silli.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
Error:
java.lang.RuntimeException: Unable to get provider com.iceteck.silicompressorr.provider.GenericFileProvider: java.lang.ClassNotFoundException: Didn't find class "com.iceteck.silicompressorr.provider.GenericFileProvider" on path: DexPathList[[zip file "/data/app/ir.mspars.azmoun-9.apk"],nativeLibraryDirectories=[/data/app-lib/ir.mspars.azmoun-9, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5131)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4722)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4605)
at android.app.ActivityThread.access$1600(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5511)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.iceteck.silicompressorr.provider.GenericFileProvider" on path: DexPathList[[zip file "/data/app/ir.mspars.azmoun-9.apk"],nativeLibraryDirectories=[/data/app-lib/ir.mspars.azmoun-9, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5116)
you may have not selected the lowest Android version when you are creating a new project.
if this is the problem try this
https://www.youtube.com/watch?v=D5lRTCaqhII&ab_channel=CodeDocu_com
The application that I am developing is crashing in some mobiles when it is not signed. When I sign the application, it works perfectly on the same devices that previously made the application crashes.
The error is:
Process: com.my.application, PID: 10293 java.lang.RuntimeException: Unable to instantiate application com.my.application.di.base.App: java.lang.ClassNotFoundException: Didn't find class "com.my.application.di.base.App" on path: DexPathList[[zip file "/data/app/com.my.application-1/base.apk"],nativeLibraryDirectories=[/data/app/com.my.application-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.my.application.di.base.App" on path: DexPathList[[zip file "/data/app/com.my.application-1/base.apk"],nativeLibraryDirectories=[/data/app/com.my.application-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:980)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
... 10 more
Suppressed: java.lang.ClassNotFoundException: com.my.application.di.base.App
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I'm not obfuscating my code, nor use instant run. I'm using multidex.
For creating debug apk create it from Build>Build APK. The issue you are facing is because of instant run.
Do you use proguard or any other method to obfuscate your code?
I think you should use multidex
In Manifest I declared
<application
android:name=com.example.App>
When the app starts, sometimes this crash happens:
java.lang.RuntimeException: Unable to instantiate application com.example.App: java.lang.ClassNotFoundException: Didn't find class "com.example.App" on path: DexPathList[[zip file "/mnt/asec/com.example.myapp-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.myapp-1/lib, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4514)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)
Is it possible to fix it somehow?
This doesn't seems to be an app crash. This is just a verbose message raised when dalvik reinstall the apk.It won't occur on end-user's device.To fix it on your development machine, just clean and rebuild.
I have integrated Telegram in one of my apps.
Its working fine on many devices and Android version, but crashing on Android 4.4, Samsung Galaxy S3.
The error log that I am getting is:
org/telegram/SQLite/SQLitePreparedStatement
java.lang.Runtime.nativeLoad(Native Method)
java.lang.Runtime.doLoad(Runtime.java:421)
java.lang.Runtime.loadLibrary(Runtime.java:362)
java.lang.System.loadLibrary(System.java:526)
org.telegram.android.NativeLoader.initNativeLibs(NativeLoader.java:196)
org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:188)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4368)
android.app.ActivityThread.access$1500(ActivityThread.java:138)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:149)
android.app.ActivityThread.main(ActivityThread.java:5045)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
dalvik.system.NativeStart.main(Native Method)
Caused by:
java.lang.ClassNotFoundException: Didn't find class "org.telegram.SQLite.SQLitePreparedStatement" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.bcd.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.bcd.app-1, /vendor/lib, /system/lib, /system/lib/arm]]
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
java.lang.ClassLoader.loadClass(ClassLoader.java:497)
java.lang.ClassLoader.loadClass(ClassLoader.java:457)
java.lang.Runtime.nativeLoad(Native Method)
java.lang.Runtime.doLoad(Runtime.java:421)
java.lang.Runtime.loadLibrary(Runtime.java:362)
java.lang.System.loadLibrary(System.java:526)
org.telegram.android.NativeLoader.initNativeLibs(NativeLoader.java:196)
Any help ?
Before all, as the above error seems, there's naming problem in the native source code and maybe it emanates from changing in package name of the project.
You should change package name in all native source code and then rebuild it.
Replace in path the two followings cases in jni folder:
Java_org_telegram_
org/telegram/
with the style of naming your packages, like the examples below:
Java_org_telegram_example_
org/telegram/example/
In the above example, the package name is:
org.telegram.example.messenger
I've recently upgraded my tools and build.gradle to version 21 in Android Studio.
My apk now crashes on load and I get the following error:
Unable to resolve superclass of Lcom/mypackage/MyClass;
Link of class 'Lcom/mypackage/MyClass
Is anyone experiencing similar issues?
I've tried the following but no success:
Cleaning the project
Restarting android studio
Re-importing the project
More log details:
java.lang.RuntimeException: Unable to instantiate application com.mypackage.MyClass:
java.lang.ClassNotFoundException: Didn't find class "com.mypackage.MyClass" on path:
DexPathList[[zip file "/data/app/com.mypackage-1.apk"],nativeLibraryDirectories=[/data/app-
lib/com.mypackage-1, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mypackage.MyClass" on path:
DexPathList[[zip file "/data/app/com.mypackage-1.apk"],nativeLibraryDirectories=[/data/app-
lib/com.mypackage-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
I later found out that this was an issue relating to multi dexing.
I needed to run a script to generate the names of the files for my main-dex-list
The blog post below has a detailed outline of this: http://blog.osom.info/2014/10/generating-main-dex-list-file.html