我的应用程序在启动时崩溃。仅当我尝试反混淆时才会发生。我是个菜鸟,但我知道我必须在 proguard-rules.pro 中添加一些例外。问题是,我不知道在那里添加什么。有人可以帮忙吗?错误日志在这里:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/oriole/oriole:12/SQ1D.220205.004/8151327:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
Timestamp: 2022-07-19 09:20:23.796556106-0700
Process uptime: 0s
Cmdline: com.XXX.demo
pid: 19614, tid: 19614, name: SDLActivity >>> com.XXX.demo <<<
uid: 10233
tagged_addr_ctrl: 0000000000000001
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'No pending exception expected: java.lang.NoSuchMethodError: no static or non-static method "Lorg/libsdl/app/SDLActivity;.onNativeSoftReturnKey()Z"
at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1121)
at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1075)
at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:998)
at void java.lang.System.loadLibrary(java.lang.String) (System.java:1656)
at void c.a.c(java.lang.String) (SourceFile:-1)
at void org.libsdl.app.SDLActivity.m() (SourceFile:-1)
at void org.libsdl.app.SDLActivity.onCreate(android.os.Bundle) (SourceFile:-1)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:8050)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:8030)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1329)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3608)
at android.app.Activity android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.app.servertransaction.PendingTransactionActions, android.content.Intent) (ActivityThread.java:3792)
at void android.app.servertransaction.LaunchActivityItem.execute(android.app.ClientTransactionHandler, android.os.IBinder, android.app.servertransaction.PendingTransactionActions) (LaunchActivityItem.java:103)
at void android.app.servertransaction.TransactionExecutor.executeCallbacks(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:135)
at void android.app.servertransaction.TransactionExecutor.execute(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:95)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2210)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:201)
at void android.os.Looper.loop() (Looper.java:288)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7839)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:548)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1003)
'
下午好。请问可以吗:
1.从设备中卸载 apk - 如果已安装
2.清洁项目
3.然后将这些规则添加到proguard-rules.pro
-keepclassmembers class org.libsdl.app.** {
public static *** **(...);
public *** **(...);
}
因此,对于 org.libsdl.app 包中的所有类,将保留具有任意数量参数的所有 public 和 static 方法,包括 SDLActivity::onNativeSoftReturnKey
4.然后构建并安装
检查您是否可以构建版本或将此配置添加到 build.gradle
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
...