-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
Description
I installed my app on Android P, there was a dialog showing "Detected problems with API compatibility (visit g.co/dev/appcompat for more info)" every time i launched my app. I enabled the new StrictMode feature and I got the stack trace:
09-18 14:42:15.389 27929-27929/com.xxx.xxx D/StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe;
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredField(Native Method)
at com.google.gson.internal.UnsafeAllocator.create(UnsafeAllocator.java:41)
at com.google.gson.internal.ConstructorConstructor$14.<init>(ConstructorConstructor.java:221)
at com.google.gson.internal.ConstructorConstructor.newUnsafeAllocator(ConstructorConstructor.java:220)
at com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:96)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:101)
at com.google.gson.Gson.getAdapter(Gson.java:457)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53)
at com.google.gson.Gson.getAdapter(Gson.java:457)
at retrofit2.converter.gson.GsonConverterFactory.responseBodyConverter(GsonConverterFactory.java:63)
at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:330)
at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:313)
at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:739)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:172)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170)
at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
So there is any solution or workaround not to reflect system non-open api?
Rolf-Smit, Hazer, gabin8, Pkmmte, Halin-Lee and 25 more