Search Unity

Resolved Game crashes on start up after implementing Admob

Discussion in 'Android' started by beta4attack, Jul 7, 2017.

  1. beta4attack

    beta4attack

    Joined:
    Jun 3, 2017
    Posts:
    3
    Hello! I'm sorry to bother you all and I'm sorry if it's a noob thing to ask for help with, but this issue has been driving me nuts!
    I decided to integrate Admob into my Android game and as soon as I did that, the game started crashing after the Unity splashscreen whenever I build that game on my mobile. I tried several solutions from searching on Google from people who had similar issues than me and they all had this issue because they had both Google Game Services and Admob in their games, note that I also have Google Game Service in my game. Though, I'm not sure if that's still applicable because how many updates to both Google Play Services and Admob have rolled since those people had those issues.
    And yes, the game compiles and no errors when run inside the Unity Editor. And it ran perfectly fine on mobile right before adding Admob And it only started crashing once I added it.

    Here's my logcat:
    Code (csharp):
    1. --------- beginning of crash
    2. --------- beginning of system
    3. --------- beginning of main
    4. 07-07 10:18:16.996 25689 25714 E Unity   : Unable to find AudioPluginMsHRTF
    5. 07-07 10:18:16.997 25689 25714 E Unity   : Unable to find AudioPluginOculusSpatializer
    6. 07-07 10:18:16.998 25689 25714 E Unity   : Unable to find libAudioPluginOculusSpatializer
    7. 07-07 10:18:17.056 25689 25714 D Unity   :  GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT
    8. 07-07 10:18:17.056 25689 25714 D Unity   : _texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
    And here's my Manifest from MainLibProj:
    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!-- This file was automatically generated by the Google Play Games plugin for Unity
    3.      Do not edit. -->
    4. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    5.     package="com.google.example.games.mainlibproj"
    6.     android:versionCode="1"
    7.     android:versionName="1.0" >
    8.  
    9.     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" />
    10.  
    11.     <application>
    12.  
    13.      <!-- Required for Nearby Connections API -->
    14.         <meta-data android:name="com.google.android.gms.nearby.connection.SERVICE_ID"
    15.             android:value="" />
    16.  
    17.         <!-- the space in these forces it to be interpreted as a string vs. int -->
    18.         <meta-data android:name="com.google.android.gms.games.APP_ID"
    19.             android:value="\ My game ID" />
    20.         <meta-data android:name="com.google.android.gms.games.unityVersion"
    21.             android:value="\ 0.9.39a" />
    22.         <meta-data android:name="com.google.android.gms.version"
    23.             android:value="@integer/google_play_services_version" />
    24.  
    25.       <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ My game ID"/>
    26.       <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ My game ID"/>
    27.  
    28.         <activity android:name="com.google.games.bridge.NativeBridgeActivity"
    29.             android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    30.  
    31.  
    32.     </application>
    33. </manifest>
    34.  
    My Android Plugins manifest:
    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2.  
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    4.       package="com.izaron.androideffects.vibration"
    5.       android:versionCode="1"
    6.       android:versionName="1.0">
    7.   <uses-sdk android:minSdkVersion="16" />
    8.   <application android:label="@string/app_name"
    9.                android:icon="@drawable/app_icon"
    10.                after="" android:hardwareAccelerated="true">
    11.     <activity android:name="com.izaron.androideffects.vibration.MyMainActivity"
    12.               android:configChanges="keyboardHidden|orientation"
    13.               android:label="@string/app_name">
    14.       <intent-filter>
    15.         <action android:name="android.intent.action.MAIN" />
    16.         <category android:name="android.intent.category.LAUNCHER" />
    17.       </intent-filter>
    18.     </activity>
    19.   </application>
    20.  
    21.   <uses-permission android:name="android.permission.VIBRATE"/>
    22.  
    23. </manifest>
    My Google Ads manifest:
    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!--
    3. This Google Mobile Ads plugin library manifest will get merged with your
    4. application's manifest, adding the necessary activity and permissions
    5. required for displaying ads.
    6. -->
    7. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    8.    package="com.google.unity"
    9.    android:versionName="1.0"
    10.    android:versionCode="1">
    11.  <uses-sdk android:minSdkVersion="16"
    12.      android:targetSdkVersion="24" />
    13.  <application>
    14.  </application>
    15. </manifest>
    I'd really appreciate if anyone can guide me to the right place before giving up completely on AdMob. I'm so sorry for bothering you and thanks in advance for your patience with me.
     
    Last edited: Jul 7, 2017
  2. Dwaynor

    Dwaynor

    Joined:
    Jun 26, 2016
    Posts:
    1
    Dont know if you still having issues, but here is what worked for me in case anybody else has the same problem:

    So i was having the some problems as you after importing AdMob into my unity-project. As soon as my game started on the android device it crashed.
    After many trials i accidentally came across this Plugin https://developers.google.com/admob/unity/start. I imported this additionally and voila it fixed my problem. No more crashes after that. I dont know what exactly the problem was, but my guess is Unity was missing some files , which were include in the mobile-ads-package, which are not included in Admob(this is weird).

    Hope i could help
     
    onur84 likes this.
  3. AscentGames

    AscentGames

    Joined:
    Sep 30, 2018
    Posts:
    2
    Which plugin?
     
    RuNTTechSolutions likes this.
  4. Wolvorine_911

    Wolvorine_911

    Joined:
    Jun 27, 2018
    Posts:
    2
    After Implementing ADmob i had the same Issue , After searching for quite a while a found out you need to add AdMob App id into the manifest and swtich to gradle build system , that solved the issue for me.

    https://developers.google.com/admob/unity/start#set_your_admob_app_id

    its the link Look Under "
    Set your AdMob app ID
    "

    And After Doing that Make sure your API level is same in manifest and in unity.
    , Hope it helps
     
    Venture87, Nameelee and darklord849 like this.
  5. darklord849

    darklord849

    Joined:
    Jan 11, 2018
    Posts:
    6
    @Wolvorine_911 Thanx a ton, your solution worked for me like beauty
     
  6. emtmc

    emtmc

    Joined:
    Jan 21, 2019
    Posts:
    1
    Hi,
    I am having the same issue, When i remove the plugin the app runs perfectly, but when I add the Admob plugin the app wont launch at all, I also have Google Games Service in my game, and I have also added the app ID to the manifest. I am quite new to unity, and have spent several days trying to solve this issue with no success. Any help would be appreciated
     
  7. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    27
    Hey I have found the solution by watching a tutorial on youtube to integrate latest admob 2019 ad in unity. Hope It helps.
     
    unity_XPrzfGE6Y2PDrQ and Egliean like this.
  8. xeonx1990

    xeonx1990

    Joined:
    Apr 7, 2018
    Posts:
    2
    did you manage to solve the problem cause i have the same issue
     
  9. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    27
    You should open android monitor.bat file from android sdk and then open the app in the phone. Then you will see the error. Then you have to search for that specific error.
     
    introvert2019unleash likes this.
  10. Venture87

    Venture87

    Joined:
    Dec 22, 2014
    Posts:
    19
    mukesh_08777 likes this.
  11. introvert2019unleash

    introvert2019unleash

    Joined:
    May 19, 2019
    Posts:
    1
    This is killing me now. I have being on it for 6 hours straight. Please guys I really need detailed and simple explanation please. My app keeps crashing.
     
  12. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    27
    H
    Hey introvert you need to debug your application to find the error. You can try this link
     
  13. saadali211

    saadali211

    Joined:
    Feb 17, 2017
    Posts:
    19
    APP CRASH 2019 FIXED
    After trying everything turns out its the plugin compatibility problem here is the perfect fix for it.
     
  14. leonardpaiva

    leonardpaiva

    Joined:
    May 18, 2019
    Posts:
    2
    I tried everything around here and nothing was working, it just so happened that I was putting the wrong apps.admob.com id, don't try to use a test id, create your app on ad mob right away and get the id they give you, then you correctly configure your android id option in "assets/googlemobileads/settings" in the unity, and mark google ad mob as enabled.

    Another tip, after making the build, is to check if the id was applied correctly by going to assets / plugins / android / googlemobileadsplugin / androidmanifest open the android manifest and check if in the id's meta is the id you configured in googlemobileads / settings, example : <android meta-data: name = "com.google.android.gms.ads.APPLICATION_ID" android: value = "SEU_ADMOB_ANDROID_ID /> If you go for it, it probably won't be your id there, because it automatically applies the id there when you do the build.

    I hope it helps someone
     
    Last edited: May 19, 2020
    xpxilom likes this.
  15. Kassem_m31

    Kassem_m31

    Joined:
    Apr 17, 2020
    Posts:
    25
    what I did was deleting admob and I just followed a tutotorial step by step how to implement ads and it worked
     
  16. krushnagodhania0101

    krushnagodhania0101

    Joined:
    Apr 6, 2020
    Posts:
    2
    hello I went through this issue for weeks and what solved it for me was not using the google admob "
    Sample ad unit ID" and using my real AD mob ID. This stopped all crashes.
     
  17. harunakdogan

    harunakdogan

    Joined:
    Jan 26, 2021
    Posts:
    1
    I got same issue. I realised the whitespace at the end of my app ID :eek:
     
    maratzahidulin likes this.
  18. maratzahidulin

    maratzahidulin

    Joined:
    Jan 5, 2021
    Posts:
    3
    Thanks man.:D

    SOLVED !!! SOLVED !!! SOLVED !!! SOLVED !!!
    (at least in my case).

    Just remove any WHITE SPACES (if any) after App Id:
    Screenshot_8.png
     
  19. DevDinoAdmin

    DevDinoAdmin

    Joined:
    Oct 21, 2019
    Posts:
    4
    Helped me!
     
  20. gowthamact2022

    gowthamact2022

    Joined:
    Jun 22, 2021
    Posts:
    10
    My app too not working after implementing admob in it but before that it works good


    After implementing if crash at the start itself..
     
  21. buddikanuwan

    buddikanuwan

    Joined:
    Dec 31, 2020
    Posts:
    3
    This is the solution that worked for me...when importing admob sdk pakcage dont import android dependency manager if you are not using play services...and thats it....
     
    Momaboba likes this.
  22. vignesh211

    vignesh211

    Joined:
    Feb 8, 2019
    Posts:
    13
    Hi all,
    I have been having this problem over the last three months. Finally got to resolve it. I was pasting Ad-id in the place of app id all this time. I know this is silly but this was the mistake I was making all this time. Just make sure you are placing the ids {App id & ad id} at the right place.
     
  23. cihantay

    cihantay

    Joined:
    May 9, 2021
    Posts:
    1
    I also solved the problem by considering the following warning in the part where we wrote the Android App ID: https://ibb.co/XCXrtf2
     
    Salman78645 likes this.
  24. Salman78645

    Salman78645

    Joined:
    Nov 25, 2019
    Posts:
    2
    Thanks My Problem Solve
     
  25. osito_enojado

    osito_enojado

    Joined:
    Feb 10, 2019
    Posts:
    5
    Thanks!!!! I love you!!
     
  26. Othhh

    Othhh

    Joined:
    Feb 19, 2023
    Posts:
    1
    me to broo i was just facing this problem for 6h !!
     
  27. gamingwithdanialbusiness

    gamingwithdanialbusiness

    Joined:
    Oct 26, 2021
    Posts:
    6
    Check if the error goes away when you switch to mono , if it does then first switch back to il2cpp and then go to android studio and go to sdk manager then check that you have installed arm 64 in api level 33 ,32,31 android 11 , 12 ,13 ,10 then go back to unity and build it it may take alot of storage.
     
  28. Daveheart

    Daveheart

    Joined:
    Mar 31, 2023
    Posts:
    5
    Wolverine . . . thank you.

    this is for you:
     
  29. rajam9291

    rajam9291

    Joined:
    Oct 2, 2020
    Posts:
    2
    dont use the sample add id from google sdk website .pls use the real ad id it works for pls try this one
     
  30. heltonluizsb

    heltonluizsb

    Joined:
    Dec 20, 2018
    Posts:
    23
    Everyone problem is a blank ID in Google Mobile Ads Setting, but that is not my problem... Is something else, because I checked a thousand times if is the ID is correct and checked if has any space... I'm using Unity 2022.3.19f1

    OH! Just in case... Last week it works a couple times, but now it doesnt work anymore...
     
    Last edited: Feb 8, 2024
    ckous likes this.