I tried creating a new project on Android Studio 3.2.1. In the project creation wizard, choosing the minimum SDK version support as API level 21 (Android 5.0), created a project with the “Empty Activity” template.
I tried with both with and without “Kotlin” Support with the same result. When I tried to run this newly created application on any emulator/phone, the application crashed.
However, when I changed the minSDK to anything less than 21, the application ran successfully. It was also running fine when the minSDK version was above 21.
Note: The compileSDKVersion and targetSDKVersion was set to: 28
So, for now, the only solution seems to be not to use minSDKVersion as 21.
Here’s the crash log:
2018-11-10 02:25:43.886 3742-3742/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kbeanie.test1, PID: 3742
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kbeanie.test1/com.kbeanie.test1.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.kbeanie.test1.MainActivity" on path: DexPathList[[zip file "/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/base.apk"],nativeLibraryDirectories=[/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.kbeanie.test1.MainActivity" on path: DexPathList[[zip file "/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/base.apk"],nativeLibraryDirectories=[/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 12 more
Caused by: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
... 15 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.FragmentActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/SupportActivity;
... 15 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.SupportActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/lifecycle/LifecycleOwner;
... 15 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleOwner" on path: DexPathList[[zip file "/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/base.apk"],nativeLibraryDirectories=[/data/app/com.kbeanie.test1-BOVWTjJJqRM5jnzV5X3nnw==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more