首頁(yè)
社區(qū)
課程
招聘
替換系統(tǒng)默認(rèn)加載器動(dòng)態(tài)加載dex的startActivitySecondMethod()方法運(yùn)行報(bào)錯(cuò)

在真機(jī)系統(tǒng)版本為8.1.0上運(yùn)行報(bào)錯(cuò)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kanxue.course01, PID: 18409
java.lang.RuntimeException: Unable to resume activity {com.kanxue.course01/com.kanxue.course01.MainActivity}: java.lang.ClassCastException: androidx.appcompat.widget.ActionBarOverlayLayout cannot be cast to androidx.appcompat.widget.ActionBarOverlayLayout
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3581)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
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:807)
Caused by: java.lang.ClassCastException: androidx.appcompat.widget.ActionBarOverlayLayout cannot be cast to androidx.appcompat.widget.ActionBarOverlayLayout
at androidx.appcompat.app.WindowDecorActionBar.init(WindowDecorActionBar.java:195)
at androidx.appcompat.app.WindowDecorActionBar.<init>(WindowDecorActionBar.java:173)
at androidx.appcompat.app.AppCompatDelegateImpl.initWindowDecorActionBar(AppCompatDelegateImpl.java:403)
at androidx.appcompat.app.AppCompatDelegateImpl.getSupportActionBar(AppCompatDelegateImpl.java:383)
at androidx.appcompat.app.AppCompatDelegateImpl.onPostResume(AppCompatDelegateImpl.java:535)
at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:196)
at android.app.Activity.performResume(Activity.java:7131)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
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:807)
I/Process: Sending signal. PID: 18409 SIG: 9

 

換到模擬器上執(zhí)行亦未成功,報(bào)錯(cuò):
E/System: Unable to load dex file: /sdcard/4.dex
E/System: java.io.IOException: No original dex files found for dex location /sdcard/4.dex
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:365)
at dalvik.system.DexFile.<init>(DexFile.java:107)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:393)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:84)
at dalvik.system.DexClassLoader.<init>(DexClassLoader.java:55)
at com.kanxue.course01.MainActivity.startActivitySecondMethod(MainActivity.java:103)
at com.kanxue.course01.MainActivity.onCreate(MainActivity.java:47)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

 

將dex文件放到/data/local/tmp/下報(bào)錯(cuò):
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kanxue.course01, PID: 9949
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kanxue.course01/com.kanxue.test02.TestActivity}: java.lang.ClassNotFoundException: Didn't find class "com.kanxue.test02.TestActivity" on path: DexPathList[[zip file "/data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/lib/x86, /data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.kanxue.test02.TestActivity" on path: DexPathList[[zip file "/data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/lib/x86, /data/app/com.kanxue.course01-xc42LnD49V-g2imqDjoV2Q==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)
at android.app.Instrumentation.newActivity(Instrumentation.java:1243)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3182)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

 

目前仍未解決

收藏
0條回答
[2023秋季班]《安卓高級(jí)研修班(網(wǎng)課)》月薪三萬(wàn)計(jì)劃
  參與學(xué)習(xí)     143 人
  提問(wèn)次數(shù)     2 個(gè)
[2024]《安卓高級(jí)研修班(網(wǎng)課)》月薪三萬(wàn)計(jì)劃班、掌握調(diào)試、分析還原ollvm、vmp的方法,定制art虛擬機(jī)自動(dòng)化脫殼的方法
我的問(wèn)答 領(lǐng)取收益
0
我的提問(wèn)
0
我的回答
0
學(xué)習(xí)收益