I found these in Warning in Manifest.xml::
".MainActivity" in <activity android:name=".MainActivity"> is not a concrete class.
In android Studio error log is as below:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo Kotlin Android
Process: com.example.espl.myapplication22, PID: 9829
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.espl.myapplication22/com.example.espl.myapplication22.MainActivity}: java.lang.InstantiationException: java.lang.Class<com.example.espl.myapplication22.MainActivity> cannot be instantiated
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2398)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2547)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: java.lang.InstantiationException: java.lang.Class<com.example.espl.myapplication22.MainActivity> cannot be instantiated
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2547)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Process: com.example.espl.myapplication22, PID: 9829
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.espl.myapplication22/com.example.espl.myapplication22.MainActivity}: java.lang.InstantiationException: java.lang.Class<com.example.espl.myapplication22.MainActivity> cannot be instantiated
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2398)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2547)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: java.lang.InstantiationException: java.lang.Class<com.example.espl.myapplication22.MainActivity> cannot be instantiated
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2547)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
SOLUTION:
Remove the abstract before the class decleration of MainActivity
No comments:
Post a Comment