Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported API warnings in Google Play Store

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
like image 930
Muhammad usman Avatar asked May 11 '19 07:05

Muhammad usman


People also ask

Does Google Play store have an API?

The Google Play Games Services Publishing API allows you to automate frequent tasks having to do with game services production and distribution. The Reporting API lets you retrieve information about your app's quality from Android vitals.

Is there any official API to get app details from the Play Store?

The App Details from PlayStore is an API that returns real-time details of any Android app. It also can be used in combination with shields.io for generating Android app related badges with realtime values for an app's README file (or) any other use case for that matter.

Does Google console accept APK?

Starting August 2021, new apps are required to publish with the Android App Bundle on Google Play. New apps larger than 150MB can use either Play Asset Delivery or Play Feature Delivery. To know more, read The Future of Android App Bundles is here, on the Android Developers Blog.


2 Answers

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()             // 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()
    );
}

When running your application, should the execution of any code trigger a StrictMode violation, you should see a stack trace in the logging output indicating what triggered it:

D/StrictMode: StrictMode policy violation; ~duration=28 ms: android.os.strictmode.DiskReadViolation
  at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
  ...

After manually testing your application, searching your log output for StrictMode should help you find these easily.

Google's documentation on StrictMode also provides some additional guidance:

If you find violations that you feel are problematic, there are a variety of tools to help solve them: threads, Handler, AsyncTask, IntentService, etc. But don't feel compelled to fix everything that StrictMode finds. In particular, many cases of disk access are often necessary during the normal activity lifecycle. Use StrictMode to find things you did by accident. Network requests on the UI thread are almost always a problem, though.

like image 163
Kailash Chivhe Avatar answered Sep 28 '22 05:09

Kailash Chivhe


These warnings refer to the 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 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

like image 31
Rakymzhan Zhomartov Avatar answered Sep 28 '22 05:09

Rakymzhan Zhomartov