Android 程序奔溃常见问题汇总

2017-05-24  本文已影响0人  中華田園雞

一 、Unable to find explicit activity Class{xxx}

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.administrator.lftapp/com.example.administrator.lftapp.TestPercent}; have you declared this activity in your AndroidManifest.xml?

出现这个问题的原因一般为Activity未在AndroidManifest.xml文件中注册 打开
AndroidManifest.xml文件 在<application></application>中间添加

<activity android:name=".Activity(你的Activity名字)"/>

即可

二、Unable to instantiate activity ComponentInfo{xxxxx}

Didn't find class "com.example.administrator.lftapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.administrator.lftapp-1/base.apk"]

完整错误信息

05-25 01:04:52.053 4185-4185/com.example.administrator.lftapp
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.administrator.lftapp, PID: 4185
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.administrator.lftapp/com.example.administrator.lftapp.MainActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.example.administrator.lftapp.MainActivity"
on path: DexPathList[[zip file "/data/app/com.example.administrator.lftapp-1/base.apk"],
nativeLibraryDirectories=[/data/app/com.example.administrator.lftapp-1/lib/x86, /vendor/lib, /system/lib]]
at ajava.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

上一篇下一篇

猜你喜欢

热点阅读