[英]Is Google Play activating StrictMode for prelaunch tests?
I have submitted an app to Google Play and the Play Console prelaunch tests show a number of API policy violations (use of restricted / unsupported APIs):我已经向 Google Play 提交了一个应用程序,并且 Play 控制台预发布测试显示了许多 API 政策违规行为(使用受限/不受支持的 API):
When I check the stack traces for these events I see that the API policy violation was detected by StrictMode.当我检查这些事件的堆栈跟踪时,我看到 StrictMode 检测到 API 策略违规。 Here's one example:这是一个例子:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)V
at android.os.StrictMode.lambda$static$1(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at e.g0.k.e.b(Unknown Source:1)
at e.g0.k.e.a(Unknown Source:7)
at e.g0.k.e.d(Unknown Source:4)
at e.g0.k.e.e(Unknown Source:0)
[...]
This puzzles me for a few reasons:这让我感到困惑有几个原因:
I did not enable StrictMode in my app.我没有在我的应用程序中启用 StrictMode。 Is Google modifying the submitted APK in order to enable StrictMode for the prelaunch tests? Google 是否正在修改提交的 APK 以启用 StrictMode 进行预启动测试? I couldn't find any information on this anywhere.我在任何地方都找不到这方面的任何信息。
I am ignoring the two warnings related to View and ViewGroup (according to the report, these are known issues related to AndroidX and I don't need to do anything about them).我忽略了与 View 和 ViewGroup 相关的两个警告(根据报告,这些是与 AndroidX 相关的已知问题,我不需要对它们做任何事情)。 The other four issues are related to Conscrypt restricted APIs which are restricted starting with Android 11 (API level 30).其他四个问题与 Conscrypt 受限 API 有关,这些 API 从 Android 11(API 级别 30)开始受到限制。 My app targets Android 10 (API level 29) where usage of these APIs should be OK.我的应用程序针对 Android 10(API 级别 29),这些 API 的使用应该没问题。 Why are these reported as warnings / errors?为什么这些报告为警告/错误? Furthermore, why are 2 of them reported as warnings ("unsupported") and 2 of them reported as errors ("fully restricted")?此外,为什么其中 2 个报告为警告(“不支持”)而其中 2 个报告为错误(“完全受限”)? (all 4 are OK in Android 10 and all 4 are restricted in Android 11) (在 Android 10 中所有 4 个都可以,在 Android 11 中所有 4 个都受到限制)
Re #1, Google does not have to modify your APK to enable StrictMode.关于 #1,Google 不必修改您的 APK 即可启用 StrictMode。 I believe it might be possible to enable it device wide.我相信有可能在设备范围内启用它。
Re #2, Looking at the restricted APIs for Android 10 in, I see that Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)
is on the blacklist, which means it should throw an error at runtime.关于#2,查看 Android 10 in 的受限 API ,我看到Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)
在黑名单上,这意味着它应该抛出错误在运行时。 Also, the setAlpnProtocols
are on the greylist, not the blacklist, so that explains the difference between the warnings and the errors.此外, setAlpnProtocols
在灰名单上,而不是黑名单上,因此可以解释警告和错误之间的区别。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.