How to resolve java.lang.ClassNotFoundException in ActivityThread.performLaunchActivity? - android

For my Android application, I get the following error in Google Play's developer console:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{PACKAGE_NAME/PACKAGE_NAME.MainActivity}: java.lang.ClassNotFoundException: PACKAGE_NAME.MainActivity in loader dalvik.system.PathClassLoader[/mnt/asec/PACKAGE_NAME-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3693)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: PACKAGE_NAME.MainActivity in loader dalvik.system.PathClassLoader[/mnt/asec/PACKAGE_NAME-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
Although this error appears extremely rarely (and can probably be neglected), I find it cleaner to have a error-free developer console :) And furthermore, I would just like to know the causes for this error.
Yes, it seems as if there was a class that could not be found. But why? How can I prevent this?

Update(4/26/15):
After further research I believe you are right in the fact that its definitely a user error. The [/mnt/asec/PACKAGE_NAME-1/pkg.apk] most likely means they are trying to move your app to the SD card. Please read here:
Android intermittent class not found run time exception
"Unable to instantiate activity" error
Android: Unable to instantiate activity / ClassNotFoundException
Original:
This is a Java RuntimeException as seen by Logcat. I've seen this happen many times before when I have not added the Activity to manifest correctly.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{PACKAGE_NAME/PACKAGE_NAME.MainActivity}: java.lang.ClassNotFoundException: PACKAGE_NAME.MainActivity in loader dalvik.system.PathClassLoader[/mnt/asec/PACKAGE_NAME-1/pkg.apk]

Related

Firebase Analytics - NPE in CrashReport

I've just migrated to Firebase Analytics 9.0.0 and when tried to launch the app on emulator api10/x86, then the following exception is thrown by the services. Any ideas how to work around that?
05-23 15:36:44.371 1280-1280/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.szyk.myheart/com.szyk.myheart.MyHeartActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.google.android.gms.flags.impl.FlagProviderImpl.getBooleanFlagValue(Unknown Source)
at com.google.android.gms.internal.zzsd$zza.zzb(Unknown Source)
at com.google.android.gms.internal.zzsd$zza.zza(Unknown Source)
at com.google.android.gms.internal.zzsf.zzb(Unknown Source)
at com.google.android.gms.internal.zzsd.get(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.zzOW(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.log(Unknown Source)
at com.szyk.extras.activities.UniversalActionBarActivity.onCreate(UniversalActionBarActivity.java:46)
at com.szyk.myheart.MyHeartActivity.onCreate(MyHeartActivity.java:99)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
The code is nothing more than activity with:
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FirebaseCrash.log("onCreate: " + getClass().getSimpleName());
}
Unfortunately, using Firebase on devices or emulators without Play Services isn't a supported use case. Crash Reporting will fail to initialize, and you will see a message to that effect in logcat when the app launches. However, if you are also seeing a crash when calling a method after failed init, that seems like a problem we should correct.
It sounds like you are doing the best thing you can by suppressing the exception, but I'd rather not make you go through that, so I'll pass it on as feedback to the team.
Just small correction on what Doug mentioned. Firebase Crash Reporting is not supported on non-play devices. Firebase Analytics in particular and some of the other Firebase product do support non-play devices.

java.lang.NoClassDefFoundError when calling DolbyAudioProcessing.getDolbyAudioProcessing

I have integrated Dolby_audio_plugin_api_v1.1.1.0 into my Android app and am seeing this stack trace in a handful of cases:
java.lang.NoClassDefFoundError: com.dolby.dap.DsClientManager$AppActivityLifecycleCallbacks
at com.dolby.dap.DsClientManager.(DsClientManager.java:196)
at com.dolby.dap.DolbyAudioProcessing.(DolbyAudioProcessing.java:143)
at
com.dolby.dap.DolbyAudioProcessing.getDolbyAudioProcessing(DolbyAudioProcessing.java:125)
at com.houseofhighfives.saddest_trombone.Main.onCreate(Main.java:44)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(NativeStart.java)
Following the examples on the Dolby dev site, this is the call that tries to initialize the DolbyAudioProcessing instance:
mDolbyAudioProcessing = DolbyAudioProcessing.getDolbyAudioProcessing(this, PROFILE.MUSIC, this);
According to Crashlytics, all instances were on a Samsung GT-S5360B or GT-S5360L, running Android 2.3.6.
Very minor thing, given how infrequent it is, but it makes me curious. Has anyone else seen this before?
So this turned out to be a because the AppActivityLifecycleCallbacks is an ICS API Level interface. I should have been doing SDK_LEVEL check before calling DolbyAudioProcessing.getDolbyAudioProcessing(). – mmcmahon

How to avoid class not found exception in android

I am getting class not found exception on some android devices, it's happening only on some devices.
This is the call-stack i have got,
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.picframes.android/com.picframes.android.first}: java.lang.ClassNotFoundException: com.picframes.android.first
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2240)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.picframes.android.first
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
Any suggestions for resolving this problem, I could not reproduce this problem on my device.
On devices with which android version program works and where it doesn't work? I am not sure if this is the case but you probably get this error on older devices, is that right? You should make sure that all the functionality of your program is available on older systems. Use your manifest file:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
to define minimum sdk version, and you will get errors in your code if you are trying to use features that are not available on the device that you target.

App crashes when trying to extend SherlockActivity in android studio

After importing the actionbarsherlock module, my app crashes on any activity that extends the SherlockActivity. I am not sure if I had imported it incorrectly or something needs to be adjusted but I have followed a guide that was previously posted here on stackoverflow. If i extend Activity and not sherlockActivity there will be no crash.
Guide https://stackoverflow.com/a/16591272/1671933
Logcat
05-24 08:41:46.072 1241-1241/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.example.sandbox.TestingCam
at com.example.sandbox.LoginActivity$CheckLogin.onPostExecute(LoginActivity.java:204)
at com.example.sandbox.LoginActivity$CheckLogin.onPostExecute(LoginActivity.java:155)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
You need to make sure that the dependency scope is set to "compile". In some cases it seem to be set to "provided" which will cause a NoClassDefFoundError.

When people download my app from the google play i get this error: java.lang.RuntimeException: Unable to instantiate activity

my name is Walid.
im having this error when people download my app from google play i get this error
i think its when certain devices download the app it causes the app to crash .
this is the sdk in the manifest.
please if anyone knows how to fix this please let me know .
Thank you.
<uses-sdk
android:minSdkVersion="2"
android:targetSdkVersion="17" />
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{tigris.code.oneallah.walid/tigris.code.oneallah.walid.MenuPage}: java.lang.ClassNotFoundException: tigris.code.oneallah.walid.MenuPage in loader dalvik.system.PathClassLoader[/data/app/tigris.code.oneallah.walid-1.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3693)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: tigris.code.oneallah.walid.MenuPage in loader dalvik.system.PathClassLoader[/data/app/tigris.code.oneallah.walid-1.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
... 11 more
Your APK file does not contain a class named tigris.code.oneallah.walid.MenuPage. Either the APK is missing the class, or ProGuard renamed it.

Categories

Resources