I have found several posts regarding classNotFound for MainActivity but all seem to be related to differences in libraries between the main app and support libraries, stuff like that. I have a situation where I am simply creating a new application in Android Studio and with zero modifications, running the helo world default app, fails with this error.
07-20 23:25:46.012 7152-7152/com.rythmair.lvlvalidation D/AndroidRuntime: Shutting down VM
07-20 23:25:46.012 7152-7152/com.rythmair.lvlvalidation E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rythmair.lvlvalidation, PID: 7152
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.rythmair.lvlvalidation/com.rythmair.lvlvalidation.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.rythmair.lvlvalidation.MainActivity" on path: DexPathList[[zip file "/data/app/com.rythmair.lvlvalidation-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2968)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233)
at android.app.ActivityThread.access$1000(ActivityThread.java:197)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6873)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.rythmair.lvlvalidation.MainActivity" on path: DexPathList[[zip file "/data/app/com.rythmair.lvlvalidation-1/base.apk"],nativeLibraryDirectories=[/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.newActivity(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2958)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233)
at android.app.ActivityThread.access$1000(ActivityThread.java:197)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6873)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Suppressed: java.lang.ClassNotFoundException: com.rythmair.lvlvalidation.MainActivity
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
07-20 23:26:13.377 7152-7152/com.rythmair.lvlvalidation I/Process: Sending signal. PID: 7152 SIG: 9
Not sure what I am missing here.
Try putting this in your manifest if it is not there
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This was an odd one, given the error. The issue turned out to be access rights on the device I was testing (I think). I caught in one part of the stack that it couldn't write code to data/data/... Upon digging in a bit further, I found that I was signed in on my tablet as a test user that I use to validate licensing functionality. While logged in as this user, it would fail any time I tried to build the app with the error shown above. Once I signed back in on my tablet as myself, this issue no longer occurs.
Related
I have an App that works without problems in Android Studio, but when I Build the apk and then install it shows stranges behaviors:
1- When App is installing, phone shows me notification that no one permission is necessary for my app (and that is not true, my app works with awareness)
2- After installation, and running, the App crushed, no one screen is showed.
I was thinking that maybe could be a problem with manifest, but as I said in emulator works without problem. First time I see this behavoir. Any idea how to solve it ??
03-28 13:15:22.851 7334-7334/com.itelma.tele D/AndroidRuntime: Shutting down VM
03-28 13:15:22.851 7334-7334/com.itelma.tele E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.itelma.tele, PID: 7334
java.lang.RuntimeException: Unable to instantiate service com.itelma.tele.API_AC.FCMInstanceIdService: java.lang.ClassNotFoundException: Didn't find class "com.itelma.tele.API_AC.FCMInstanceIdService" on path: DexPathList[[zip file "/data/app/com.itelma.tele-2/base.apk"],nativeLibraryDirectories=[/data/app/com.itelma.tele-2/lib/arm, /data/app/com.itelma.tele-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3841)
at android.app.ActivityThread.access$2100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.itelma.tele.API_AC.FCMInstanceIdService" on path: DexPathList[[zip file "/data/app/com.itelma.tele-2/base.apk"],nativeLibraryDirectories=[/data/app/com.itelma.tele-2/lib/arm, /data/app/com.itelma.tele-2/base.apk!/lib/armeabi-v7a, /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.ActivityThread.handleCreateService(ActivityThread.java:3838)
at android.app.ActivityThread.access$2100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Suppressed: java.lang.ClassNotFoundException: com.itelma.tele.API_AC.FCMInstanceIdService
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)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I am facing an issue with my app:
If I deactivate within Android Studio Instant Run, my app crashes upon startup with the stacktrace:
12-29 13:36:37.876 4549-4549/com.mycoolapp.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycoolapp.debug, PID: 4549
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycoolapp.debug/com.myapp.SplashScreenActivity}: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2216)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.SplashScreenActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.mycoolapp.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mycoolapp.debug-2/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.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Suppressed: java.lang.NoClassDefFoundError: com.myapp.SplashScreenActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.myapp.SplashScreenActivity
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
As far as I have researched this belongs to multidex:
https://developer.android.com/studio/build/multidex.html
Even if I add the multiDexEnabled property to my gradle config the app crashes. Only if I enable InstantRun (which enables multidex in background), the app runs...
If I create an apk the installation works, but the app crashes on startup with the same error.
Since I have as minSDK API Level 21, there should be no other change except of the multiDexEnabled property necessary, right?
So last but not least my answer:
All my configuration for multidex was correct... I don't know why, but after a complete OS restart everything works fine now... :)
Just create new phone on AVD and try to install app on that phone. Hope it will work.
The accepted answer was only a temporary fix for me, after altering code and a few builds the error came back.
After alot of trial and error the real problem was the jdk location my project was using, instead of using the embedded jdk in android studio i was using an installed version from oracle. After going to File > Project Structure > SDK Location and checking Use embedded JDK the problem was fixed for good.
Check if your classpath
'com.android.tools.build:gradle:3.1.0-alpha05'
is up-to-date, had same problem and solved it with a full update.
10-20 20:18:53.146 19159-19159/? I/art: Late-enabling -Xcheck:jni
10-20 20:18:53.221 19159-19159/com.example.deeps.myapplication D/AndroidRuntime: Shutting down VM
10-20 20:18:53.222 19159-19159/com.example.deeps.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.deeps.myapplication, PID: 19159
java.lang.RuntimeException: Unable to 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/com.example.deeps.myapplication-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4504)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5235)
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:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.example.deeps.myapplication-1/base.apk"],nativeLibraryDirectories=[/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:979)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4504)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5235)
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:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
Suppressed: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
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
10-20 20:18:53.253 19159-19159/? I/Process: Sending signal. PID: 19159 SIG: 9
Pls try all of these options and me know the outcome. I think disabling Instant run will solve this problem but please do clean/rebuild project once too.
Disable the Instant Run option in Android Studio. To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"
Android Studio menu - Build --> Rebuild Project.
If this does not work then try this too.
Change gradle build version to
classpath 'com.android.tools.build:gradle:1.2.3'
I use deep link in an app built with Ionic on Android. When i click on the link, the app opens but crashed just one second after. How could i debug this problem ?
This is the intent code in AndroidManifest.xml:
<activity android:label="#string/app_name" android:name="com.pipp.deeplinks.LinkActivity" android:theme="#android:style/ Theme.DeviceDefault.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="pipp.app.com" android:pathPrefix="/news" android:scheme="http" />
<data android:host="actionnaires" android:scheme="pipp" />
</intent-filter>
</activity>
Thanks !
Update
By using Android Studio, i have the following logs:
10-13 11:10:24.633 20844-20844/com.pipp.actionnaires E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pipp.actionnaires, PID: 20844
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.pipp.actionnaires/com.pipp.deeplinks.LinkActivity}: java.lang.ClassNotFoundException: Didn't find class "com.pipp.deeplinks.LinkActivity" on path: DexPathList[[zip file "/data/app/com.pipp.actionnaires-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pipp.actionnaires-1/lib/x86, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pipp.deeplinks.LinkActivity" on path: DexPathList[[zip file "/data/app/com.pipp.actionnaires-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pipp.actionnaires-1/lib/x86, /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.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.pipp.deeplinks.LinkActivity
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)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
You're running from Eclipse or the Android application studio? If ionic run android application, you can debug from chrome://inspect/#devices to the device you have connected to your computer.
Working on upgrading my UrbanAirship to 7.2. No compilation errors and the app runs fine until it receives a push message. At that point, it crashes with the following stack trace:
UALib: ManifestUtils - Unable to find class:
com.urbanairship.push.GCMPushReceiver
java.lang.ClassNotFoundException:
com.urbanairship.push.GCMPushReceiver
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at
com.urbanairship.util.ManifestUtils.validateManifest(ManifestUtils.java:215)
at com.urbanairship.UAirship.validateManifest(UAirship.java:736)
at com.urbanairship.UAirship.executeTakeOff(UAirship.java:343)
at com.urbanairship.UAirship.access$000(UAirship.java:42)
at com.urbanairship.UAirship$2.run(UAirship.java:299)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.urbanairship.push.GCMPushReceiver" on path: DexPathList[[zip file
"/data/app/com.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx-1/lib/arm,
/data/app/com.xxx-1/base.apk!/lib/armeabi-v7a, /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 java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at
com.urbanairship.util.ManifestUtils.validateManifest(ManifestUtils.java:215)
at com.urbanairship.UAirship.validateManifest(UAirship.java:736)
at com.urbanairship.UAirship.executeTakeOff(UAirship.java:343)
at com.urbanairship.UAirship.access$000(UAirship.java:42)
at com.urbanairship.UAirship$2.run(UAirship.java:299)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException:
com.urbanairship.push.GCMPushReceiver
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)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the
boot class loader; no stack trace available
When I check to see if the class is visible (Cmd-O) and start typing, the class comes up immediately.
Has anyone encountered this? I have no idea how to fix it. Thanks.
We renamed GCMPushReceiver to GcmPushReceiver. You should remove all the Urban Airship receivers, services, and activities from your manifest and let auto manifest integration merge them for you.