gpt4 book ai didi

android - java.lang.VerifyError : Rejecting class that attempts to sub-class erroneous class 错误

转载 作者:搜寻专家 更新时间:2023-11-01 08:21:03 27 4
gpt4 key购买 nike

在将 proguard 应用于应用程序时出现以下验证错误,我看到了验证错误的其他变体,但以下内容似乎有些不同,混淆器版本:5.3.3,以下 MainApplication 类扩展了 android.app.Application 并在 super.onCreate() 发生崩溃; onCreate() 方法的定义

在我的proguard中有

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgent

,我也提到了

-不要收缩-不要优化

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapplication, PID: 18598
java.lang.VerifyError: Rejecting class com.myapplication.MainApplication that attempts to sub-type erroneous class ak (declaration of 'com.myapplication.MainApplication' appears in /data/app/com.myapplication-v4oPXfQv5kNLX1oUA9GwUw==/base.apk)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newApplication(Instrumentation.java:1102)
at android.app.Instrumentation.newApplication(Instrumentation.java:1087)
at android.app.LoadedApk.makeApplication(LoadedApk.java:983)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5715)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
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.VerifyError: Rejecting class ak that attempts to sub-type erroneous class en (declaration of 'ak' appears in /data/app/com.myapplication-v4oPXfQv5kNLX1oUA9GwUw==/base.apk)
at java.lang.Class.newInstance(Native Method) 
at android.app.Instrumentation.newApplication(Instrumentation.java:1102) 
at android.app.Instrumentation.newApplication(Instrumentation.java:1087) 
at android.app.LoadedApk.makeApplication(LoadedApk.java:983) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5715) 
at android.app.ActivityThread.-wrap1(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
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.VerifyError: Verifier rejected class en: void en.<init>(android.content.Context) failed to verify: void en.<init>(android.content.Context): [0xA] thrown class Precise Reference: bjp not instanceof ThrowableVerifier rejected class en: void en.attachBaseContext(android.content.Context) failed to verify: void en.attachBaseContext(android.content.Context): [0x7] thrown class Precise Reference: bjp not instanceof Throwable

通过分析 apk,我可以看到以下内容在没有 proguard 的情况下没有被混淆

.class public Lcom/myapplication/MainApplication;
.super Landroid/app/Application;
.source "MainApplication.java"

但是一旦我应用混淆器,它就被混淆了,

.class public Lcom/myapplication/MainApplication;
.super Lak;
.source "SourceFile"

如果我错了,请纠正我, 与以下

-keep public class * extends android.app.Application

它不能混淆应用程序类,为什么会发生上述情况..?

最佳答案

在解决了很多冲突和 rebase 后,我遇到了完全相同的错误。我刚刚清理了项目并重建了它。它像魅力一样再次发挥作用。

关于android - java.lang.VerifyError : Rejecting class that attempts to sub-class erroneous class 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51037874/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com