使用应用内评论时 Google Play Core 库中神秘崩溃? (错误的行号、错误的文件名...)

问题描述 投票:0回答:1

在实施应用内评论后,我在谷歌播放库中遇到了一个神秘的错误,它没有意义。这是来自控制台的崩溃报告:

java.lang.RuntimeException: 
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3790)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3830)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3038)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: 
  at android.os.Parcel.readException (Parcel.java:1971)
  at android.os.Parcel.readException (Parcel.java:1913)
  at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting (IPackageManager.java:5720)
  at android.app.ApplicationPackageManager.setComponentEnabledSetting (ApplicationPackageManager.java:2912)
  at com.google.android.play.core.internal.bh.h (bh.java:80)
  at com.google.android.play.core.common.PlayCoreDialogWrapperActivity.a (PlayCoreDialogWrapperActivity.java:16)
  at com.google.android.play.core.review.ReviewManagerFactory.create (ReviewManagerFactory.java)
  at com.myapp.mypackage.SettingsActivity.onResume (SettingsActivity.java:11)
  at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1361)
  at android.app.Activity.performResume (Activity.java:7415)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3765)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3830)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3038)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)

问题:

  1. 没有名为
    com.google.android.play.core.internal.bh.h
    的类。为什么它没有被反混淆?我上传了正确的mapping.txt文件
  2. 它说崩溃发生在我的班级
    onResume
    方法
    com.myapp.mypackage.SettingsActivity.onResume
    的第 11 行。这是不正确的,第 11 行没有代码,只是导入...我的活动中的
    onResume
    方法位于第 100 多行。为什么崩溃报告报告随机、不正确的行?
  3. 我也尝试调查类
    com.google.android.play.core.common.PlayCoreDialogWrapperActivity.a (PlayCoreDialogWrapperActivity.java:16)
    但再一次 - 第 16 行没有任何内容,只有导入

我的代码(实际上只是来自官方 Google 文档的复制粘贴)-它显然在这里的某个地方崩溃了,但我不知道在哪一行以及为什么会发生崩溃,因为崩溃报告中的行号不正确:

ReviewManagerFactory reviewManager = ReviewManagerFactory.create(context);
Task<ReviewInfo> request = reviewManager.requestReviewFlow();
            request.addOnCompleteListener(new OnCompleteListener<ReviewInfo>() {
                @Override
                public void onComplete(@NonNull Task<ReviewInfo> task) {
                    // 1. everything ok => we show in-app review sheet at the bottom
                    if (task.isSuccessful()) {
                        // We can get the ReviewInfo object
                        ReviewInfo reviewInfo = task.getResult();
                        Task<Void> flow = reviewManager.launchReviewFlow((Activity) context, reviewInfo);
                        flow.addOnCompleteListener(task1 -> {
                            // The flow has finished. The API does not indicate whether the user
                            // reviewed or not, or even whether the review dialog was shown. Thus, no
                            // matter the result, we continue our app flow.
                        }).addOnFailureListener(task2 -> {
                            // nothing
                        });
                    }
                }
            });

当类名称或行没有任何意义时,如何实际解决这样的崩溃报告?

我需要在 proguard 中添加一些行吗?

Ay 顶部、提示或建议如何处理这样的崩溃报告?谢谢

android google-play-console
1个回答
0
投票

我遇到了这个问题,我用这个代码片段解决了它:

`proguard-rules.pro:

-keep class com.google.android.play.core.review.** { *; }
-keep class com.google.android.play.core.tasks.** { *; }
-keep class com.google.android.play.core.common.PlayCoreDialogWrapperActivity

我希望这有帮助

© www.soinside.com 2019 - 2024. All rights reserved.