Note that there are some explanatory texts on larger screens.

plurals
  1. POExplanation for random ClassNotFoundExceptions?
    primarykey
    data
    text
    <p>I have an app with ~11k active installs for which I sometimes receive ClassNotFoundExceptions that I can't explain. They look like this:</p> <pre><code>java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{name.of.my.MainActivityClass}: java.lang.ClassNotFoundException: name.of.my.MainActivityClass in loader dalvik.system.PathClassLoader[/mnt/asec/name.of.my-2/pkg.apk] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851) at android.app.ActivityThread.access$1500(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:4293) 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:849) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: name.of.my.MainActivityClass in loader dalvik.system.PathClassLoader[/mnt/asec/name.of.my-2/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:1040) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735) ... 11 more </code></pre> <p>I received some of these exceptions from users that updated my app (not only for the most recent version), so I think it is not a problem that is specific to some phones as the app worked for them before. I got these exception reports for my main activity class, a receiver class and a BackupAgent class. All of those classes are always instantiated directly from Android. My Manifest file looks like this:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="name.of.my" android:versionCode="20" android:versionName="1.10.2" android:installLocation="auto"&gt; &lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" /&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:backupAgent="name.of.my.OwnBackupAgent"&gt; &lt;activity android:name="name.of.my.MainActivityClass" android:label="@string/app_name" android:theme="@style/MyTheme"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;receiver android:name="name.of.my.OwnReceiver"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.media.RINGER_MODE_CHANGED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>After searching the net for some hours, the most likely explanations I found are:</p> <ul> <li>it might be related to moving the app to SD card while there are still some services running (but the android dev guide says that all services are canceled in this case, and it doesn't explain why my main activity class suddenly can't be found anymore)</li> <li>the .apk might be corrupted after updating via the android market. Could this be true? If yes, what can I do against it - if not, what else might be the problem?</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload