When I upload my game to my Android device, I get the following warning:

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredConstructorInternal(Native Method)
    at java.lang.Class.getConstructor0(Class.java:2325)
    at java.lang.Class.getDeclaredConstructor(Class.java:2166)
    at bitter.jnibridge.JNIBridge$a.<init>(Unknown Source:25)
    at bitter.jnibridge.JNIBridge.newInterfaceProxy(Unknown Source:8)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:193)
    at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)

What causes this, and how can I resolve it?

  • \$\begingroup\$ it's a warning that something is accessing one of those private APIs (that is, APIs that are not part of the public SDK and are accessed via reflection) that may be removed in the future. \$\endgroup\$ – Zibelas Feb 25 '20 at 8:40
  • \$\begingroup\$ Dude First all thank u and 2nd how do i solve it in unity \$\endgroup\$ – Ali Raza Feb 25 '20 at 9:12
  • \$\begingroup\$ Depends on which component is calling it, for example in this question stackoverflow.com/questions/51988819/… they tell you you can ignore it, since it's something internal. \$\endgroup\$ – Zibelas Feb 25 '20 at 9:31
  • \$\begingroup\$ This Q&A about finding what code violated strict mode might be useful here. \$\endgroup\$ – DMGregory Feb 25 '20 at 12:03
  • \$\begingroup\$ Thank u So much Every One Actually this warning are because of my ads api packages and iap packages cause i m not using the latest one As I m using api level 28 instead of 29 so google is trying to warn me that the api packages which i m using in my games is not compatible with api level 29 or might be removed in future \$\endgroup\$ – Ali Raza Mar 5 '20 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.