Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Crash on ad when stripping is enabled

Discussion in 'Unity Ads & User Acquisition' started by Delvatron, Jan 12, 2020.

  1. Delvatron

    Delvatron

    Joined:
    Jan 20, 2017
    Posts:
    1
    Hello,

    I'm using Unity Ads 3.4.1 (from the asset store) and I have an issue for which I couldn't really find a solution. I tried to display an ad on an Android 4.4.4 Kitkat phone and the game crashed. I looked up in logcat and found the following :

    • 01-13 00:12:43.207: E/Unity(20386): Java interface default methods are only supported since Android Oreo
    • 01-13 00:12:43.607: E/Unity(20386): Exception: No such proxy method: UnityEngine.Advertisements.Platform.Android.AndroidPlatform.equals(UnityEngine.AndroidJavaObject)
    • 01-13 00:12:43.607: E/Unity(20386): at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00160] in /Users/builduser/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:112
    • 01-13 00:12:43.607: E/Unity(20386): at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, UnityEngine.AndroidJavaObject[] javaArgs) [0x0002c] in /Users/builduser/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:119
    • 01-13 00:12:43.607: E/Unity(20386): at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs) [0x00066] in /Users/builduser/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:745

    Followed by

    • 01-13 00:12:43.607: E/AndroidRuntime(20386): Caused by: java.lang.NullPointerException: null result when primitive expected
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at $Proxy8.equals(Native Method)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at java.util.HashMap.put(HashMap.java:408)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at java.util.HashSet.add(HashSet.java:95)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at com.unity3d.ads.properties.AdsProperties.getListeners(AdsProperties.java:49)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at com.unity3d.services.ads.api.Listener$5.run(Listener.java:76)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at android.os.Handler.handleCallback(Handler.java:733)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at android.os.Handler.dispatchMessage(Handler.java:95)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at android.os.Looper.loop(Looper.java:136)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at android.app.ActivityThread.main(ActivityThread.java:5584)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at java.lang.reflect.Method.invokeNative(Native Method)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at java.lang.reflect.Method.invoke(Method.java:515)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
    • 01-13 00:12:43.607: E/AndroidRuntime(20386): at dalvik.system.NativeStart.main(Native Method)
    • 01-13 00:12:44.017: E/Unity(20386): java.io.EOFException


    I tried with a more recent phone Android 8.1 Oreo and it worked just fine.

    After many hours of trying to figure out what was the problem (Creating empty projects which worked just fine) I disabled code stripping and Unity ads were finally working.

    Since Unity Monetization comes with a link.xml file I guess it should not be a problem.

    To sum up I don't really know if this is a bug on Unity Sdk side or if I'm missing something.

    I could use a bit of help here :)

    Thanks in advance
    Valentin