Note that there are some explanatory texts on larger screens.

plurals
  1. POSigned APK sometimes work, other times doesn't
    text
    copied!<p>After updating ADT to 22.3, sometimes APKs can be signed, but throws <code>ClassNotFoundException</code> when testing, as exemplified below (it seems to always affect the class extending <code>Application</code>):</p> <pre><code>12-19 16:32:04.374: E/AndroidRuntime(25074): FATAL EXCEPTION: main 12-19 16:32:04.374: E/AndroidRuntime(25074): java.lang.RuntimeException: Unable to instantiate application com.innostreams.vieshow.ApplicationSettings: java.lang.ClassNotFoundException: com.innostreams.vieshow.ApplicationSettings 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.LoadedApk.makeApplication(LoadedApk.java:501) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4201) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.ActivityThread.access$1300(ActivityThread.java:140) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1287) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.os.Handler.dispatchMessage(Handler.java:99) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.os.Looper.loop(Looper.java:137) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.ActivityThread.main(ActivityThread.java:4898) 12-19 16:32:04.374: E/AndroidRuntime(25074): at java.lang.reflect.Method.invokeNative(Native Method) 12-19 16:32:04.374: E/AndroidRuntime(25074): at java.lang.reflect.Method.invoke(Method.java:511) 12-19 16:32:04.374: E/AndroidRuntime(25074): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 12-19 16:32:04.374: E/AndroidRuntime(25074): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 12-19 16:32:04.374: E/AndroidRuntime(25074): at dalvik.system.NativeStart.main(Native Method) 12-19 16:32:04.374: E/AndroidRuntime(25074): Caused by: java.lang.ClassNotFoundException: com.innostreams.vieshow.ApplicationSettings 12-19 16:32:04.374: E/AndroidRuntime(25074): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 12-19 16:32:04.374: E/AndroidRuntime(25074): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 12-19 16:32:04.374: E/AndroidRuntime(25074): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.Instrumentation.newApplication(Instrumentation.java:971) 12-19 16:32:04.374: E/AndroidRuntime(25074): at android.app.LoadedApk.makeApplication(LoadedApk.java:496) 12-19 16:32:04.374: E/AndroidRuntime(25074): ... 11 more </code></pre> <p>When this is encountered, generating another signed APK would usually solve the problem and the APK can then be installed an run without issues. No code was changed between the two signed APK builds, and project need not be cleaned, all it took to create a "correct" signed APK was to export a signed APK (<strong>righ click project->Android Tools->Export signed application package...</strong>), so this couldn't be an issue with the code nor the project setup. What I wish to know is:</p> <ol> <li>Why is this happening</li> <li>How do I fix it once and for all</li> </ol> <p><strong>Edit</strong>: Please note that the application <em>never</em> encounters the above issue when "unsigned" (aka signed with debug certificate) version is installed and ran.</p>
 

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