Tuesday, June 13, 2017

Android Issue - Unable to Instantiate Application

This issue(Unable to Instantiate Application - ClassNotFoundException)  can be occured by many reasons. Rood cause could be different package name in manifest file, unsupported architecture, missing libs, etc.

I faced the similar issue today. But it only happened when the app was installed by adb command. It worked fine if app's installed from Android Studio.

This is the error detail:
java.lang.RuntimeException: Unable to instantiate application com.demo.app: java.lang.ClassNotFoundException: Didn't find class "com.demo.app" on path: DexPathList[[zip file "/data/app/com.demo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.vkey.demo/lib/arm, /data/app/com.demo-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]

After I've read a few questions on Stackoverflow and tried a few ways, I found the solution on this page finally.  Thanks to Nick and Dileep Patel !!!

Solution is disabling Instant Run in Settings

  1. Open the Settings or Preferences dialog.
  2. Navigate to Build, Execution, Deployment > Instant Run.
  3. Uncheck the box next to Enable Instant Run.


References: https://developer.android.com and Stackoverflow

No comments: