Muh*_*man 18 android unity-game-engine
我在 Google Play 的发布前报告中收到以下警告。
我不知道如何纠正这些。感谢任何帮助或建议,我在这里遇到很多问题
Android compatibility
We’ve detected that your app is using unsupported APIs. Tests may not have found all unsupported APIs. Learn more
Unsupported
12 warnings identified
The following APIs are greylisted and Google can’t guarantee that they will work on existing versions of Android. Some may be already be restricted for your target SDK
API Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
11 occurrences identified. Only unique stack traces are shown.
API Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z
1 occurrence identified
API Landroid/media/AudioSystem;->getPrimaryOutputFrameCount()I
1 occurrence identified
API Landroid/media/AudioSystem;->getPrimaryOutputSamplingRate()I
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V
1 occurrence identified
API Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V
1 occurrence identifiedRun Code Online (Sandbox Code Playgroud)
小智 14
我遇到了类似的问题,我通过在 MainActivity 的 onCreate() 中添加以下代码获得了 NonSdkApiUsedViolation 日志,它为我提供了导致它的 API 调用的精确位置。
if (BuildConfig.BUILD_TYPE.contentEquals("debug")) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy
.Builder()
.detectAll() // Checks for all violations
.penaltyLog() // Output violations via logging
.build()
);
StrictMode.setVmPolicy(new StrictMode.VmPolicy
.Builder()
.detectNonSdkApiUsage() // Detect private API usage
.penaltyLog() // Output violations via logging
.build()
);
}
Run Code Online (Sandbox Code Playgroud)
在运行您的应用程序时,如果任何代码的执行触发了StrictMode违规,您应该在日志输出中看到一个堆栈跟踪,指示是什么触发了它:
D/StrictMode: StrictMode policy violation; ~duration=28 ms: android.os.strictmode.DiskReadViolation
at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
...
Run Code Online (Sandbox Code Playgroud)
在手动测试您的应用程序后,搜索您的日志输出StrictMode应该可以帮助您轻松找到这些。
Google 关于 StrictMode 的文档还提供了一些额外的指导:
如果您发现您认为有问题的违规行为,有多种工具可以帮助解决它们:线程、处理程序、AsyncTask、IntentService 等。但不要被迫修复 StrictMode 发现的所有内容。特别是,在正常的活动生命周期中,经常需要许多磁盘访问情况。使用 StrictMode 查找您不小心做的事情。但是,UI 线程上的网络请求几乎总是一个问题。
小智 2
这些警告涉及受限非 SDK 接口的使用。 https://developer.android.com/distribute/best-practices/develop/restrictions-non-sdk-interfaces
这些调用可能会导致不正确的行为或应用程序崩溃。建议避免使用它们。所有用途均属于黑名单、灰名单或白名单。如果您无法摆脱这些用法,请检查从属关系以列出。只有列入黑名单的呼叫才会导致崩溃。另外,提醒一下,Android Q (targetSDK=29) 已更新黑名单 https://developer.android.com/preview/non-sdk-q
| 归档时间: |
|
| 查看次数: |
7403 次 |
| 最近记录: |