Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample not working on android #1132

Closed
samavan opened this issue Jan 8, 2020 · 7 comments
Closed

Sample not working on android #1132

samavan opened this issue Jan 8, 2020 · 7 comments

Comments

@samavan
Copy link

samavan commented Jan 8, 2020

Unity 2020.1.0a17

What I do :

  1. Clone the Git project.
  2. Open Unity project to path : ...\samples\HelloWorld.
  3. Download & import GoogleMobileAds-v4.2.0.unitypackage.
  4. Let the Android resolver do its job.
  5. Click on Asset > Google Mobile Ads > Settings... to make a GoogleMobileAdsSettings node.
  6. Enabled > on, android app Id copied from the GoogleMobileAdsDemoScript.cs file.
  7. Click on Asset >Play Service Resolver > Android Resolver > Resolve ( no idea why I do but anyway....).
  8. Build & Run.
  9. Android pop up > Unfortunately, HelloWorld has stopped.

Actually my previous Issues mention the iOS app test working but not mine.
But once I switched platform to Android, I got the same crash on Android.

Thank you for your assistance! :)

@stowy
Copy link
Contributor

stowy commented Jan 8, 2020

Hi, can you please capture the logs from logcat that you are seeing and share?

@samavan
Copy link
Author

samavan commented Jan 9, 2020

There is actually a log from Google Ad.
Now one more time, I am using the Sample code and last admob plugin version without any editing as I did on iOS (which works on iOS).

D/AndroidRuntime(18370): Shutting down VM
E/AndroidRuntime(18370): FATAL EXCEPTION: main
E/AndroidRuntime(18370): Process: com.DefaultCompany.HelloWorld, PID: 18370
E/AndroidRuntime(18370): java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
E/AndroidRuntime(18370):
E/AndroidRuntime(18370): ******************************************************************************
E/AndroidRuntime(18370): * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
E/AndroidRuntime(18370): * should follow the instructions here: *
E/AndroidRuntime(18370): * https://googlemobileadssdk.page.link/admob-android-update-manifest *
E/AndroidRuntime(18370): * to add a valid App ID inside the AndroidManifest. *
E/AndroidRuntime(18370): * Google Ad Manager publishers should follow instructions here: *
E/AndroidRuntime(18370): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
E/AndroidRuntime(18370): ******************************************************************************
E/AndroidRuntime(18370):
E/AndroidRuntime(18370):
E/AndroidRuntime(18370): at android.app.ActivityThread.installProvider(ActivityThread.java:6461)
E/AndroidRuntime(18370): at android.app.ActivityThread.installContentProviders(ActivityThread.java:6053)
E/AndroidRuntime(18370): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5993)
E/AndroidRuntime(18370): at android.app.ActivityThread.access$1700(ActivityThread.java:218)
E/AndroidRuntime(18370): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1779)
E/AndroidRuntime(18370): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(18370): at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(18370): at android.app.ActivityThread.main(ActivityThread.java:6917)
E/AndroidRuntime(18370): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18370): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(18370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
E/AndroidRuntime(18370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
E/AndroidRuntime(18370): Caused by: java.lang.IllegalStateException:
E/AndroidRuntime(18370):
E/AndroidRuntime(18370): ******************************************************************************
E/AndroidRuntime(18370): * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
E/AndroidRuntime(18370): * should follow the instructions here: *
E/AndroidRuntime(18370): * https://googlemobileadssdk.page.link/admob-android-update-manifest *
E/AndroidRuntime(18370): * to add a valid App ID inside the AndroidManifest. *
E/AndroidRuntime(18370): * Google Ad Manager publishers should follow instructions here: *
E/AndroidRuntime(18370): * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
E/AndroidRuntime(18370): ******************************************************************************
E/AndroidRuntime(18370):
E/AndroidRuntime(18370):
E/AndroidRuntime(18370): at com.google.android.gms.internal.ads.zzxw.attachInfo(com.google.android.gms:play-services-ads-lite@@18.3.0:27)
E/AndroidRuntime(18370): at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@18.3.0:3)
E/AndroidRuntime(18370): at android.app.ActivityThread.installProvider(ActivityThread.java:6458)
E/AndroidRuntime(18370): ... 11 more

@samavan
Copy link
Author

samavan commented Jan 9, 2020

GoogleMobileAdsPlugin/AndroidManifest.xml contents :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.unity.ads" android:versionName="1.0" android:versionCode="1">
  <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="ca-app-pub-3940256099942544~3347511713" />
  </application>
</manifest>

@samavan
Copy link
Author

samavan commented Jan 9, 2020

Below the url to the original HelloProject where I imported the plugins, updated the Settings, etc...
I think you could simply open it then Build&Run to get the same issue... :)

Thank you! ;)

@arialblack14
Copy link

arialblack14 commented Mar 22, 2020

I am having the same issue.
It was driving me nuts since I have never used Admob before.
I added a sample AndroidManifest.xml file in Assets/Plugins/ and I have a working build but without ads.

Did you manage to find a solution @samavan ?

@wenderRondonia
Copy link

also having similar issue, but from your logcat it seems"The Google Mobile Ads SDK was initialized incorrectly. AdMob publisher" and then " to add a valid App ID inside the AndroidManifest" https://googlemobileadssdk.page.link/ad-manager-android-update-manifest

@stowy
Copy link
Contributor

stowy commented May 29, 2020

Which version of Unity is this in? PR #1310 fixes an issue with Unity 2020.x that may cause this. It's not yet released but you can apply the changes in your project until then.

@kunny kunny closed this as completed Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants