Usage of non-SDK interfaces, Google play console


I am currently developing my first app, so I am not an expert on android, the point is that I have uploaded my app to test the google play console, but in the section "Report before launch" (where it is tested the apk in different levels of android api) it tells me that I have a problem for android 9 with a red icon and with the message of:


Problem: Usage of non-SDK interfaces

I've read this , this and some other entries, and from what I understand is that they are trying to prevent developers from using elements of android and java that have not been designed to be used directly.

In the emulator, my app works as it should at that level of api but in logcat it generates entries such as (I only quote some, they really are many):

Accessing hidden method Landroid/app/ActivityThread;->currentActivityThread()Landroid/app/ActivityThread; (light greylist, reflection)
Accessing hidden field Landroid/app/ActivityThread;->mActivities:Landroid/util/ArrayMap; (light greylist, reflection)

Even in a newly generated project it also generates me entries of that type, and from what I see all the entries it generates belong to light greylist.

Is that really an impediment for me to launch my app in the playstore?

If so, what should I do to identify where these methods and / or attributes are being accessed?

To add, I want to clarify that I do not have access to a physical device with this level of api.

I appreciate your attention.

asked by dTobon 26.10.2018 в 19:10

1 answer


The message:


Usage of non-SDK interfaces

It means that you are using Classes, methods, attributes that are not part of the SDK but are accessed at runtime. Remember that we can access these elements through reflection (Reflection) .

In this case you mention that you are using Android 9 and precisely in this version of the operating system it is this beginning to prohibit access via reflection to these elements .

For example, in the LogCat I can see that you have this message:


Accessing hidden method   Landroid / app / ActivityThread; - > currentActivityThread () Landroid / app / ActivityThread;   (light greylist, reflection)

Probably in your code you have:

import java.lang.reflect.Method;

Method m = activityThread.getMethod("currentActivityThread", new Class[0]);

Review the document: Improving stability by reducing the use of interfaces that are not SDK (English)


Is that really an impediment for me to launch my app in the   playstore?

I suggest that while you check your code and modify it, define in your file build.gradle maximum: compileSdkVersion 27 and targetSdkVersion 27 and you generate this way your .APK.


What should I do to identify where those accesses are being accessed?   methods and / or attributes?

in your classes you would be using the import :

import java.lang.reflect.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

also from Class.forName() , example:

 Class<?> cls = Class.forName("Jorgesys");
answered by 26.10.2018 в 19:44