Search code examples
androidunity-game-enginesdkads

Admob crashing my app at the beginning of launch


I decided to install Admob. However, after installing the Mobile Ads Unity plugin, the application starts and stops working at the beginning of launch. I've tried multiple solutions.

One of them I added the following codes to AndroidManifest:

 <application>
<uses-library android:required="false" android:name="org.apache.http.legacy"/>  
<meta-data

android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB APPLICATION ID]"/> //I changed only this ID
</application>

But this did not work. I've been through this for a long time. Can you please help? With my all respect ..

Log cat says Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArraySet"


Solution

  • I use 2019.1.5f1 version of unity. When Admob and GooglePlay added same project, application starts and stops working at the beginning of launch. So you need to do this;

    GoogleleMobileAds > Editor > GoogleMobileAdsDependencies

    Open it with Visual Studio and change this code;

    <androidPackage spec="com.google.android.gms:play-services-ads:18.0.0">
    

    Change it with this code;

    <androidPackage spec="com.google.android.gms:play-services-ads:17.1.1">
    

    I hope its help you.