AppLovin / AppLovin-MAX-SDK-Android

Other
210 stars 95 forks source link

Attempt to invoke virtual method 'com.applovin.sdk.AppLovinSdkSettings com.applovin.sdk.AppLovinSdk.getSettings()' on a null object reference #604

Closed doomcha closed 5 months ago

doomcha commented 6 months ago

MAX SDK Version

12.1.0

Device/Platform Info

Android 11

Current Behavior

When calling MaxSdk.InitializeSdk(); I get the following error in 100% cases:

`2023-12-18 15:56:38.529 25057 29466 Error Unity AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'com.applovin.sdk.AppLovinSdkSettings com.applovin.sdk.AppLovinSdk.getSettings()' on a null object reference

2023-12-18 15:56:38.529 25057 29466 Error Unity java.lang.NullPointerException: Attempt to invoke virtual method 'com.applovin.sdk.AppLovinSdkSettings com.applovin.sdk.AppLovinSdk.getSettings()' on a null object reference

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.applovin.mediation.unity.MaxUnityPlugin.generateSdkSettings(MaxUnityPlugin.java:1398)

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.applovin.mediation.unity.MaxUnityPlugin.initializeSdk(MaxUnityPlugin.java:98)

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method)

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0)

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.unity3d.player.UnityPlayer$F$a.handleMessage(Unknown Source:122)

2023-12-18 15:56:38.529 25057 29466 Error Unity at android.os.Handler.dispatchMessage(Handler.java:102)

2023-12-18 15:56:38.529 25057 29466 Error Unity at android.os.Looper.loop(Looper.java:246)

2023-12-18 15:56:38.529 25057 29466 Error Unity at com.unity3d.player.UnityPlayer$F.run(Unknown Source:24)

2023-12-18 15:56:38.529 25057 29466 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 `

Expected Behavior

Max SDK should initialize properly.

How to Reproduce

Update max sdk to the latest version (Unity plugin 6.1.1, Android plugin 12.1.0) Have following adapters: Inmoby, Ironsource, Unity, GoogleAdMob of the latest versions for 18 Dec 2023 Have Google UMP flow enabled. Have following settings:

image

Build and try to initialize MaxSDK

Additional Info

No response

thomasmso commented 6 months ago

@doomcha - We're aware of the issue. In the meantime please call setMuted() after initializing the SDK. Also to be clear before this update calling setMuted() before initializing the SDK did not do anything

doomcha commented 6 months ago

It cost me 4 days of banging my head against the wall :) as the exception occurs after calling Initialize, not after setMuted so it was almost impossible to connect it with setMuted. Thanks, the solution works!

maximilianbuck commented 5 months ago

@doomcha a fix for the exception was released in Unity plugin version 6.1.2