Googleads-mobile-unity: Unity 2020.1 breaks the plugin completly

Created on 8 May 2020  路  14Comments  路  Source: googleads/googleads-mobile-unity

[REQUIRED] Step 1: Describe your environment

  • Unity version: 2020.1b8
  • Google Mobile Ads Unity plugin version: tried 5.1.0 and 5.0.1
  • Platform: Unity editor, Android
  • Platform OS version: windows 10 , android 8
  • Any specific devices issue occurs on: ____
  • Mediation ad networks used, and their versions: none

[REQUIRED] Step 2: Describe the problem

the apk crash at start on android device.
and also this bug https://github.com/googleads/googleads-mobile-unity/issues/1295

Steps to reproduce:

-create a new empty project(use 2d template, it will save compilations times)
-install the plugin
-resolve the google services jars
-enable admob and paste android admob app id
-"build and run" apk.

the apk will crash when opening

What happened? How can we make the problem occur?
the game/app crashes at start because "the Google Mobile Ads SDK was initialized incorrectly"
I know that the crash at the start can be caused when leaving the admob app id field empty.
but in this case I am 100% sure that I wrote correctly the admob app id.

So my theory is that Unity 2020.1 changed something and breaked the plugin compatibility.

I confirmed this by testing the lastest plugin on 2019.3.1 (no problems there)

This could be a description, log/console output, etc.

unity android logcat

"fatal error
The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to add a valid App ID inside the AndroidManifest. *
* Google Ad Manager publishers should follow instructions here: *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest."

Most helpful comment

Experiencing the same issue, upgrading from Unity 2019.4 with a build that's been working for months, and now with the newly released 2020.1.0f1 it's broken with the "The Google Mobile Ads SDK was initialized incorrectly." error causing a hard crash.

All 14 comments

Hi, please refer to the documentation and ensure that you are setting your iOS and Android AdMob App IDs.

That said if you are doing this then it sounds like the build processing steps are not running, I will verify.

yes, i literally copied from the button on the admob dashboard(copy to clipboard) and pasted the app id on the settings asset and doens't work

its like its not inyecting or applying the admob app id to the android manifest maybe.

I've verified this and found a resolution. If you rename the folder Assets/Plugins/Android/GoogleMobileAdsPlugin to Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib it will import the plugin manifest and the issue should be resolved.

I'll need to make this change and create a new release to support 2020.1. We don't officially support beta releases. Feel free to create a pull request, if you do ensure that you use git mv to track the change.

changing the name of the folder makes a error that prevents compilation

BuildMethodException: [GoogleMobileAds] AndroidManifest.xml is missing. Try re-importing the plugin.
ManifestProcessor.StopBuildWithMessage (System.String message) (at Assets/GoogleMobileAds/Editor/ManifestProcessor.cs:175)
ManifestProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Assets/GoogleMobileAds/Editor/ManifestProcessor.cs:52)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass15_0.b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at <96ac283d3ed54c8586075d55d7cc2a57>:0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List1[T] oneInterfaces, System.Action1[T] invocationOne, System.Collections.Generic.List1[T] twoInterfaces, System.Action1[T] invocationTwo, System.Boolean exitOnFailure) (at <96ac283d3ed54c8586075d55d7cc2a57>:0)

I don't know how to do or what pull request are. but anyway i will wait until unity 2020.1 comes out of beta and you support it officially. whichever happens first,

I'm not in a hurry so i can wait.

edit:

If you rename the folder Assets/Plugins/Android/GoogleMobileAdsPlugin to Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib it will import the plugin manifest and the issue should be resolved.

I also needed to edit the ManifestProcessor.cs to change the path to make it coincide with the new path. now it works thank you.

BuildMethodException: [GoogleMobileAds] AndroidManifest.xml is missing. Try re-importing the plugin.
ManifestProcessor.StopBuildWithMessage (System.String message) (at Assets/GoogleMobileAds/Editor/ManifestProcessor.cs:175)
ManifestProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Assets/GoogleMobileAds/Editor/ManifestProcessor.cs:52)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass15_0.b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:411)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List1[T] oneInterfaces, System.Action1[T] invocationOne, System.Collections.Generic.List1[T] twoInterfaces, System.Action1[T] invocationTwo, System.Boolean exitOnFailure) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:391)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:136)

Same problem in the 2019.4.2f1 LTS when I switch to Android from iOS. And when I followed the instruction to re-import the package. It told me that the methods are duplicate. Changing the folder name doesn't work in this version.

EDIT: I fixed it by manually removing the existing Admob plugin and dependent and then re-import them after searching around in a few hours.

Experiencing the same issue, upgrading from Unity 2019.4 with a build that's been working for months, and now with the newly released 2020.1.0f1 it's broken with the "The Google Mobile Ads SDK was initialized incorrectly." error causing a hard crash.

@Volcore this was fixed in the admob pluigin 5.2.0, are you using this version?

I had upgraded to 5.2.0. But it turned out that one of the folders got renamed (Assets/Plugins/Android/GoogleMobileAdsPlugin got an added .androidlib). I did a complete clean and re-imported the library and it ended up working. I think a lot of people will run into the same issue when they upgrade, so it should probably be communicated, or the library show a warning if the old folder is detected.

well, the release notes states the change.

The same error in Unity 2020.1.4f1 with GoogleMobileAds-v5.3.0.
Adding .androidlib to Assets/Plugins/Android/GoogleMobileAdsPlugin resolved the problem.

Same error... ".androidlib" already in project, but not resolve problem. Error stay. In other project with same unity 2020.1.11 and GoogleMobileAds-v5.3.0 all worked. App ID check 10+ times. I don't know what to do anymore ...

The same error in Unity 2020.1.4f1 with GoogleMobileAds-v5.3.0.
Adding .androidlib to Assets/Plugins/Android/GoogleMobileAdsPlugin resolved the problem.

the 5.3.0 version should already have the .androidlib there. unless you upgraded from an old version.

To anyone who may read this;
From admob 5.2.0 and upwards this is already fixed
If you are upgrading from an older version than that. A fresh install of the pluigin is needed .
I tested in 2020.2b too and admob 5.4.0 worked fine.
Always make sure that the app id has no invisible spaces at the start or the end in the unity editor. this is a common user mistake

please make sure of checking all this before posting another comment in a already closed topic.

I upgrade from older. Delete all folders: GooglePlayGames in Assets and Plugins/Android. Install plugin. Resolve dependencies. Add App ID, check spaces. Not work. In my other project all working, but in this - no...

@koljanich this should be working as @pipe-alt has stated. I also tested 5.4.0 without issues. If you continue to have issues please post on our developer forum and the staff there will assist you.

Was this page helpful?
0 / 5 - 0 ratings