Search Unity

App does not work when using AdMob

Discussion in 'Editor & General Support' started by BL4CK0UT19, Aug 26, 2019.

  1. BL4CK0UT19

    BL4CK0UT19

    Joined:
    Aug 21, 2019
    Posts:
    75
    Hey,sorry if i'm posting this in the wrong place.

    So im making an android game,it's working fine.
    I used AdMob on it and tried to Build and Run,but i was getting an error everytime i tried to start the app on my smartphone (i have 2,and they both failed).
    I removed every code and all the plugins related to AdMob and the API,tried to build and run,and it worked fine with no problems.

    At this moment,i have removed the ads,but i really want to use them.

    I followed THIS VIDEO :

    And did EXACTLY what he did and nothing more. ( i had no idea how to put ads on the game).

    Can someone help,or send me another video guide that works?
    Also,how do i test the ads? I know about the Dummy ads already,but can i see the Ads when i connect my phone to the editor? Or i can only see when i download my game from play store?

    Thanks for the help!
     
  2. BL4CK0UT19

    BL4CK0UT19

    Joined:
    Aug 21, 2019
    Posts:
    75
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Make sure you've added your Admob id to the AndroidManifest.xml.

    E.g.
    In application tag:
    Code (CSharp):
    1.    <application>
    2.         <meta-data
    3.                 android:name="com.google.android.gms.ads.APPLICATION_ID"
    4.                 android:value="your-Admob-Id-Here"/>
    5.     </application>
    If you did, make sure you've resolved dependency libraries correctly (e.g. via Play Services Resolver).

    And to get an actual proper error, hook your device via usb, and check your logs.
    E.g. via logcat in Android Monitor.
     
    BL4CK0UT19 likes this.
  4. BL4CK0UT19

    BL4CK0UT19

    Joined:
    Aug 21, 2019
    Posts:
    75

    Hey friend,thanks for the help!
    Some other people told me the same thing,the problem is,i have no ideia how to get to this AndroidManifest.xml file!
    I tried on a Eclipse plugin,but it did not worked
     
  5. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Go to Plugins/Android. If there's no AndroidManifest.xml, create one.
    Then. simply add:
    Code (CSharp):
    1. <manifest>
    2.     <application>
    3.         <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
    4.         <meta-data
    5.             android:name="com.google.android.gms.ads.APPLICATION_ID"
    6.             android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    7.     </application>
    8. </manifest>
     
    BL4CK0UT19 likes this.
  6. BL4CK0UT19

    BL4CK0UT19

    Joined:
    Aug 21, 2019
    Posts:
    75
    Okay,i'll do that as soon as i get home.
    How do i create the AndroidManifest.xml? right click/create/ what???
     
  7. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Use default (Show in) Explorer or smth. Just right click in the folder, create a .txt file. Then rename the .txt extension to the .xml. Make sure you have extensions enabled.
     
  8. DamurStudio

    DamurStudio

    Joined:
    Jun 16, 2020
    Posts:
    1
    To create android manifest you go to Edit>Project Settings> Player> Publishing settings > Check "Custom Main Manifest". and after you check it, below that will be appear the location of your android manifest.