user3519023 user3519023 - 4 days ago 5
Android Question

Android Studio: How do I debug an Android application that's displaying the error "Unfortunetly, App has stopped working" in emulator?

I'm getting the following error when I try to run my application in Android Studio emulator "Unfortunately, App has stopped working". Initially, I had some problems with my Manifest file where the android:theme was not set to AppCompat and my activities path was incorrect. However, after fixing those problems I'm getting the following exception in my logcat:

--------- beginning of crash
FATAL EXCEPTION: main
Process: PID: 2437
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.MyApp/main.AuthenticationActivity}: java.lang.ClassNotFoundException: Didn't find class "main.AuthenticationActivity" on path: DexPathList[[zip file "/data/app/com.android.MyApp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2236)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "main.AuthenticationActivity" on path: DexPathList[[zip file "/data/app/com.android.MyApp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Suppressed: java.lang.ClassNotFoundException: Didn't find class "main.AuthenticationActivity" on path: DexPathList[[dex file "/data/data/com.cashcellapp.cashcell1/files/instant-run/dex/slice-support-annotations-25.0.1_42819d7f76047c9e0a0c3aeb87b7df0e7845d32d-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-retrofit-2.0.0_4eb8b792b4162379025bb060ecac3f97f74e9e9a-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-okio-1.6.0_2fcfbbfbb9299076f82163ae7e0b2a5f5b4f9c55-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-okhttp-3.2.0_05f96cdce477d238fb875bf37b74cfdfffdd4807-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-internal_impl-25.0.1_c17fc84d6e9b91cf30e75b86c2b0c0903db60597-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-internal_impl-25.0.1_b73daeb4305fc5ccc5f47ec15f27ba346f270c7f-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-internal_impl-25.0.1_b282ec23366e0cd822272543608a85c09bfdd648-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-internal_impl-25.0.1_a69bc217d2fa88f95b41f7f714111b0f99b5f659-classes.dex", dex file "/data/data/com.android.MyApp/files/instant-run/dex/slice-
11-28 01:43:25.875 1572-1800/system_process W/ActivityManager:


And this is my AndroidManifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.MyApp">


<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat">
<activity android:name="main.AuthenticationActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="main.HomeActivity"
android:label="@string/app_name">
</activity>
</application>

</manifest>


I went through all the posts relevant to this website and tried my best to form my question clearly. I'm still new to this so I'm open to all constructive criticism.

From what I understand it's saying that it couldn't find the file path for the main activity, and I double checked that I had the correct file path entered on all of my files. Any help would be really appreciated.

Answer

change your code in manifest :"main.AuthenticationActivity" to ".main.AuthenticationActivity".

Comments