本文主要是介绍ShareEntryActivity java.lang.ClassNotFoundException | Android类找不到问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
错误堆栈:
Process: com.mci.smagazine, PID: 23265java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mci.smagazine/com.mci.smagazine.apshare.ShareEntryActivity}: java.lang.ClassNotFoundException: com.mci.smagazine.apshare.ShareEntryActivity in loader com.zhangyue.iReader.plugin.d[DexPathList[[zip file "/data/app/com.mci.smagazine-oVAsxbpVt3Q0D6kLqRDP-g==/base.apk"],nativeLibraryDirectories=[/system/lib, /vendor/lib]]]at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2911)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3101)at android.app.ActivityThread.-wrap12(Unknown Source:0)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1741)at android.os.Handler.dispatchMessage(Handler.java:106)at android.os.Looper.loop(Looper.java:187)at android.app.ActivityThread.main(ActivityThread.java:7114)at java.lang.reflect.Method.invoke(Native Method)at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:814)Caused by: java.lang.ClassNotFoundException: com.mci.smagazine.apshare.ShareEntryActivity in loader com.zhangyue.iReader.plugin.d[DexPathList[[zip file "/data/app/com.mci.smagazine-oVAsxbpVt3Q0D6kLqRDP-g==/base.apk"],nativeLibraryDirectories=[/system/lib, /vendor/lib]]]at com.zhangyue.iReader.plugin.d.loadClass(SourceFile:90)at java.lang.ClassLoader.loadClass(ClassLoader.java:312)at android.app.Instrumentation.newActivity(Instrumentation.java:1195)at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3101) at android.app.ActivityThread.-wrap12(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1741) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:187) at android.app.ActivityThread.main(ActivityThread.java:7114)
我的清单里面的声明:
<!--支付宝分享回调--><activityandroid:name="${applicationId}.apshare.ShareEntryActivity"android:configChanges="orientation|keyboardHidden|navigation|screenSize|layoutDirection|smallestScreenSize|screenLayout"android:exported="true"android:screenOrientation="portrait" />
别人反馈了一个崩溃,log 发给我了。说找不到ShareEntryActivity。我搜了以下工程,确实没有这个类。这个应该是支付宝分享回调的类,我去找测试,测试找了下应该是没有分享的入口。
我突然想到,支付宝分享应该是去掉了的。怎么还会启动呢?不可能。
我全局搜索了一下ShareEntryActivity,我擦,清单里面竟然还有这个声明。
立马就想到,如果外部启动你这个ShareEntryActivity ,你肯定类找不到崩溃。
于是自己用adb 模拟一下:
adb shell
am start-activity com.mci.smagazine/com.mci.smagazine.apshare.ShareEntryActivity
或者am start com.mci.smagazine/com.mci.smagazine.apshare.ShareEntryActivity(有的adb 工具不识别start-activity)
下面这行是让掌阅app 崩溃的
am start-activity com.chaozh.iReaderFree/com.chaozh.iReaderFree.apshare.ShareEntryActivity
总结:
1.清单里面不用的activity 声明,一定要去掉。否则别人随便攻击一下,你就找不到类崩溃了。而且你还自以为是的说,我程序中本来就没有这个类。那没有这个类,你干嘛声明呢?
2.有时候,类找不到,不一定清单里面没有声明。有时候搜索要全局搜索一下。
这篇关于ShareEntryActivity java.lang.ClassNotFoundException | Android类找不到问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!