我的应用程序在测试设备上运行但在 Playstore 上崩溃并出现此错误:
异常 java.lang.RuntimeException: 在 android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4048) 在 android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4312) 在 android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:101) 在 android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135) 在 android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95) 在 android.app.ActivityThread$H.handleMessage (ActivityThread.java:2571) 在 android.os.Handler.dispatchMessage (Handler.java:106) 处 android.os.Looper.loopOnce (Looper.java:226) 在 android.os.Looper.loop (Looper.java:313) 在 android.app.ActivityThread.main (ActivityThread.java:8741) 在 java.lang.reflect.Method.invoke 在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) 在 com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067) 由 java.lang.ClassNotFoundException:
引起 在 dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:259) 在 java.lang.ClassLoader.loadClass (ClassLoader.java:379) 在 java.lang.ClassLoader.loadClass (ClassLoader.java:312) 在 android.app.AppComponentFactory.instantiateActivity (AppComponentFactory.java:95) 在 androidx.core.app.CoreComponentFactory.instantiateActivity (CoreComponentFactory.java:45) 在 android.app.Instrumentation.newActivity (Instrumentation.java:1328)
在 android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4035)
我认为它可能与混淆器有关,所以我尝试通过在平台>android>应用程序中创建一个
proguaurd-rules.pro
文件来禁用它,这样应用程序文件包含proguard-rules.pro 我老实说我从另一个项目复制并粘贴了它所以也许这引起了一个问题,但我认为不会。
在我添加该文件后,我进入了 build.gradle 并添加了这段代码:
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
}
这对崩溃没有任何作用,所以我返回并将代码更改为:
release {
signingConfig signingConfigs.release
minifyEnabled false
useproguard false
proguardFiles 'proguard-rules.pro'
}
debug {
minifyEnabled false
useproguard false
proguardFiles 'proguard-rules.pro'
}
}
崩溃仍在发生,我仍然在游戏控制台上收到相同的错误消息,我做错了什么?这甚至是混淆问题还是其他问题?
更新:从那以后,我通过添加库并在默认配置中启用 multidex 来添加 multidex 支持,这对崩溃没有任何作用。
这是日志:
2023-04-17 19:32:57.775 11564-11564/? I/Calculator.FRE: Late-enabling -Xcheck:jni
2023-04-17 19:32:58.821 11564-11564/? E/Calculator.FRE: Unknown bits set in runtime_flags: 0x8000
2023-04-17 19:32:58.824 11564-11564/? W/Calculator.FRE: Unexpected CPU variant for X86 using defaults: x86
2023-04-17 19:33:05.098 11564-11564/com.BMICalculator.FREE I/Calculator.FRE: Waiting for a blocking GC ClassLinker
2023-04-17 19:33:05.228 11564-11564/com.BMICalculator.FREE I/Calculator.FRE: WaitForGcToComplete blocked ClassLinker on HeapTrim for 130.343ms
2023-04-17 19:33:05.525 11564-11564/com.BMICalculator.FREE D/AndroidRuntime: Shutting down VM
2023-04-17 19:33:05.555 11564-11596/com.BMICalculator.FREE D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2023-04-17 19:33:05.555 11564-11596/com.BMICalculator.FREE W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
2023-04-17 19:33:05.581 11564-11564/com.BMICalculator.FREE E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.BMICalculator.FREE, PID: 11564
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.BMICalculator.FREE/com.BMICalculator.FREE.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.BMICalculator.FREE.MainActivity" on path: DexPathList[[zip file "/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/base.apk"],nativeLibraryDirectories=[/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/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.BMICalculator.FREE.MainActivity" on path: DexPathList[[zip file "/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/base.apk"],nativeLibraryDirectories=[/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/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:45)
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)
2023-04-17 19:33:05.676 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2023-04-17 19:33:05.678 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2023-04-17 19:33:05.688 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2023-04-17 19:33:05.705 11564-11564/com.BMICalculator.FREE I/Process: Sending signal. PID: 11564 SIG: 9
2023-04-17 19:33:05.552 11564-11564/? W/RenderThread: type=1400 audit(0.0:82): avc: denied { write } for name="property_service" dev="tmpfs" ino=6318 scontext=u:r:untrusted_app:s0:c153,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.BMICalculator.FREE2023-04-17 19:32:57.775 11564-11564/? I/Calculator.FRE: Late-enabling -Xcheck:jni
2023-04-17 19:32:58.821 11564-11564/? E/Calculator.FRE: Unknown bits set in runtime_flags: 0x8000
2023-04-17 19:32:58.824 11564-11564/? W/Calculator.FRE: Unexpected CPU variant for X86 using defaults: x86
2023-04-17 19:33:05.098 11564-11564/com.BMICalculator.FREE I/Calculator.FRE: Waiting for a blocking GC ClassLinker
2023-04-17 19:33:05.228 11564-11564/com.BMICalculator.FREE I/Calculator.FRE: WaitForGcToComplete blocked ClassLinker on HeapTrim for 130.343ms
2023-04-17 19:33:05.525 11564-11564/com.BMICalculator.FREE D/AndroidRuntime: Shutting down VM
2023-04-17 19:33:05.555 11564-11596/com.BMICalculator.FREE D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2023-04-17 19:33:05.555 11564-11596/com.BMICalculator.FREE W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
2023-04-17 19:33:05.581 11564-11564/com.BMICalculator.FREE E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.BMICalculator.FREE, PID: 11564
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.BMICalculator.FREE/com.BMICalculator.FREE.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.BMICalculator.FREE.MainActivity" on path: DexPathList[[zip file "/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/base.apk"],nativeLibraryDirectories=[/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/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.BMICalculator.FREE.MainActivity" on path: DexPathList[[zip file "/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/base.apk"],nativeLibraryDirectories=[/data/app/com.BMICalculator.FREE-7yb4W7NdqCUw_5mYxhAjRA==/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:45)
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)
2023-04-17 19:33:05.676 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2023-04-17 19:33:05.678 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2023-04-17 19:33:05.688 11564-11596/com.BMICalculator.FREE D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2023-04-17 19:33:05.705 11564-11564/com.BMICalculator.FREE I/Process: Sending signal. PID: 11564 SIG: 9
2023-04-17 19:33:05.552 11564-11564/? W/RenderThread: type=1400 audit(0.0:82): avc: denied { write } for name="property_service" dev="tmpfs" ino=6318 scontext=u:r:untrusted_app:s0:c153,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.BMICalculator.FREE