1. 程式人生 > 實用技巧 >Android Studio報錯:Didn‘t find class “XXXActivity“ on path

Android Studio報錯:Didn‘t find class “XXXActivity“ on path

在執行專案的時候報錯:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.bj.xw/com.bj.xw.MainActivity}: java.lang.ClassNotFoundException: Didn’t find class “com.bj.xw.MainActivity” on path: DexPathList[[zip file “/data/app/com.bj.xw-2/base.apk”],nativeLibraryDirectories=[/data/app/com.bj.xw-2/lib/arm64, /vendor/lib64, /system/lib64]]

Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.bj.xw.MainActivity” on path: DexPathList[[zip file “/data/app/com.bj.xw-2/base.apk”],nativeLibraryDirectories=[/data/app/com.snxun.bj.xw-2/lib/arm64, /vendor/lib64, /system/lib64]]
在這裡插入圖片描述
解決辦法:
開啟AndroidManifest.xml你一定會發現有標紅報錯的地方,是因為註冊Activity的路徑寫錯了,修改一下就好。

在這裡插入圖片描述