androidreact-nativeapplovin

Applovin how to initialize sdk in Android


I am trying to initialize the applovin sdk for my react-native app per these instructions: https://developers.google.com/admob/android/mediation/applovin#step_3_import_the_applovin_sdk_and_adapter

On step 3, I am not sure how exactly to use the code AppLovinSdk.initializeSdk(context);. I put it in my MainActivity.java onCreate method, but I get a cannot find symbol error since AppLovinSdk is not defined. What exactly am I missing?


Solution

  • AppLovinSdk is not defined

    Then import it using this line

    import com.applovin.sdk.AppLovinSdk;
    

    But, you really should be using an Application class's onCreate rather than an Activity since that SDK would be global to the app, rather than per-Activity.