Unsupported API warnings in Google Play Store

2020-03-23 17:46发布

I am getting the following warnings in the pre-launch report from Google Play.

I am at a loss as to how to correct these. Any help or recommendations is appreciated i am having lots of issues here

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 identified

2条回答
家丑人穷心不美
2楼-- · 2020-03-23 18:28

These warnings refers to usage of restricted non-SDK interfaces. https://developer.android.com/distribute/best-practices/develop/restrictions-non-sdk-interfaces

These calls may lead to incorrect behavior or app's crashes. It is recommended to avoid them. All usages belong to blacklist, greylist or whitelist. If you can`t get rid of these usages, check affiliation to list. Only blacklisted calls lead to crashes. Also, just to remind, Android Q (targetSDK=29) has updated blacklist https://developer.android.com/preview/non-sdk-q

查看更多
Fickle 薄情
3楼-- · 2020-03-23 18:31

I had similar issues I got the NonSdkApiUsedViolation Logs by adding the below code in onCreate() of my MainActivity, it gave me the precise location of the API call causing it.

if( BuildConfig.BUILD_TYPE.contentEquals( "debug" ) ){
        StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder()
                                            .detectAll()
                                            .penaltyLog()
                                            .build());
        StrictMode.setVmPolicy( new StrictMode.VmPolicy.Builder()
                                       .detectNonSdkApiUsage()
                                       .penaltyLog()
                                       .build());
 }
查看更多
登录 后发表回答