我是AndroidStudio的新手,学习如何通过Udacity程序进行编码," Android Basics"。我目前正在使用第3.13课"在手机上运行Hello World应用程序"。我已按照说明一步一步地尝试在手机上启动应用程序(OnePlus5)。但是,只要我按下播放按钮,消息" MyApp就会停止"。它让我可以选择重新打开应用程序,但消息"生日快乐一直停止"出现。
02-10 12:45:08.376 7992-7992/com.example.android.happybirthday E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.happybirthday, PID: 7992
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.happybirthday/com.example.android.happybirthday.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.happybirthday.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2847)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.happybirthday.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1190)
02-10 12:45:08.377 7992-7992/com.example.android.happybirthday E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2837)
... 9 more
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: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
02-10 12:45:08.378 7992-7992/com.example.android.happybirthday E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.happybirthday, PID: 7992
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.happybirthday/com.example.android.happybirthday.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.happybirthday.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2847)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.happybirthday.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1190)
02-10 12:45:08.378 7992-7992/com.example.android.happybirthday E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2837)
... 9 more
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: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/base.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.happybirthday-KxEHHSDZIiC4FI1vJwwPDw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 15 more
02-10 12:45:08.379 7992-7992/com.example.android.happybirthday D/AppTracker: App Event: crash
答案 0 :(得分:0)
检查类的拼写是否正确,检查Activity是否是正确的包,以及是否在清单中声明了Activity。