AppLovin / AppLovin-MAX-SDK-Android

Other
233 stars 104 forks source link

Crash: Adding Terms & Privacy with minified build #659

Closed adurandet closed 2 weeks ago

adurandet commented 7 months ago

MAX SDK Version

12.4.2

Device/Platform Info

Is not device / plateform specific

Current Behavior

I am trying to add Terms and Privacy UMP flow. I followed your documentation.

I did a first attempt programmatically and try the json integration but both solution lead to a crash.

Programmaticly - Logs

D  [AppLovinSdkInitializationConfiguration] Initializing with key: 
D  [AppLovinSdkInitializationConfiguration] setMediationProvider(mediationProvider=max)
D  [ConsentFlowSettingsImpl] Setting consent flow enabled: true
D  [ConsentFlowSettingsImpl] Setting privacy policy: https://privacy
D  [ConsentFlowSettingsImpl] Setting terms of service: https://terms
D  [AppLovinSdk] 
   ========================================
   SDK Session Begin
   ========================================
E  FATAL EXCEPTION: main
   Process: com.xyz.ft.debug, PID: 20837
   java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference
    at com.applovin.impl.r4.a(SourceFile:19)
    at com.applovin.impl.r4.a(SourceFile:116)
    at com.applovin.impl.r4.a(SourceFile:90)
    at com.applovin.impl.r4.c(SourceFile:1)
    at com.applovin.impl.U.run(Unknown Source:27)
    at android.os.Handler.handleCallback(Handler.java:959)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8501)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

JSON - logs

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference
       at com.applovin.impl.r4.a(SourceFile:1601)
       at com.applovin.impl.r4.a(SourceFile:2963)
       at com.applovin.impl.r4.a(SourceFile:2259)
       at android.os.Handler.handleCallback(Handler.java:959)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loopOnce(Looper.java:232)
       at android.os.Looper.loop(Looper.java:317)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
[PersistentPostbackQueueSaveTask] Postbacks queue file does not exist.

The crash doesn't occur when the app is NOT minify. So it could be a R8/Progruard issue.

Expected Behavior

UMP flow should be dispay and app not crash.

How to Reproduce

Build an app to display UMP flow with minify enabled. Init AppLovin SDK -> App crash.

Additional Info

No response

adurandet commented 7 months ago

By using the following code, though I can see termsFlowSettings is deprecated, I managed to see the popup you can see in screenshot but taping continue I am still facing a crash.

val initConfig = AppLovinSdkInitializationConfiguration.builder(AppLovinKey.appLovinKey, context)
            .setMediationProvider(AppLovinMediationProvider.MAX)
            .configureSettings { settings ->
                settings.termsAndPrivacyPolicyFlowSettings.apply {
                    isEnabled = true
                }
                settings.termsFlowSettings.apply {
                    privacyPolicyUri = Uri.parse(Urls.privacy)
                    termsOfServiceUri = Uri.parse(Urls.terms)
                }
            }
            .build()

        AppLovinSdk.getInstance(context)
            .initialize(initConfig) {
                _isInitialized.value = true
            }

popup

FATAL EXCEPTION: main
Process: com.xyz.ft.debug, PID: 4979
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference
    at com.applovin.impl.r4.a(SourceFile:19)
    at com.applovin.impl.r4.a(SourceFile:5)
    at com.applovin.impl.r4$c.onClick(Unknown Source:19)
    at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:175)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8501)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
adurandet commented 7 months ago

Issue has been resolved by adding the following proguard rule -keep class org.json.** { *; }

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 5 days since being marked as stale.