googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.37k stars 1.08k forks source link

Mediation Test Suite 1.2.2 crash android #1121

Closed Thaina closed 4 years ago

Thaina commented 4 years ago

Build android with latest Google Mobile Ads Unity Plugin v4.1.0 with Vungle UnityAd ChartBoost and AdColony mediation. When opening the test suite, it seem normal until I try to go into any mediation to load ad, it crash

logcat is like this

12-27 17:31:03.346  6895  6895 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MyCompany.MyApp/com.google.android.ads.mediationtestsuite.activities.NetworkDetailActivity}: java.lang.IllegalStateException: MobileAds.initialize() must be called prior to getting version string.
12-27 17:31:03.346  6895  6895 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2928)
12-27 17:31:03.346  6895  6895 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)

....
....
....
....

12-27 17:31:04.136  7201  7201 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MyCompany.MyApp/com.google.android.ads.mediationtestsuite.activities.HomeActivity}: java.lang.NullPointerException: Attempt to invoke direct method 'com.google.android.ads.mediationtestsuite.dataobjects.ProductTheme com.google.android.ads.mediationtestsuite.utils.logging.TestSuiteState.getProductThemeInstance()' on a null object reference
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2928)
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
12-27 17:31:04.136  7201  7201 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)

Using 1.0.0 work fine except Vungle cannot be tested ( same as #859 )

dnyanesh11118 commented 4 years ago

Good

stowy commented 4 years ago

@Thaina This may be happening because you are not initializing the Mobile Ads SDK before launching the test suite. The AdMob Unity documentation specifies that you should initialize the SDK on app launch.

Also, are you including the AdMob App ID in your application manifest, as per these docs?

Thaina commented 4 years ago

@stowy Did anything become difference between 1.0.0 and 1.2.2 ? In 1.0.0 I don't need to do initial bits

stowy commented 4 years ago

Yes quite a bit has changed, see these Android release notes:

https://groups.google.com/forum/#!searchin/google-admob-ads-sdk/mediation$20test$20suite%7Csort:date/google-admob-ads-sdk/cFrbpA4Rgwk/UqAWiz5aBQAJ

I don't quite follow what you mean when you say you don't do initial bits?

On Sun, Dec 29, 2019 at 8:24 PM Thaina Yu notifications@github.com wrote:

@stowy https://github.com/stowy Did anything become difference between 1.0.0 and 1.2.2 ? In 1.0.0 I don't need to do initial bits

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/1121?email_source=notifications&email_token=ABNGOFFM6QHX7I3WXZYAFT3Q3FZZPA5CNFSM4J7Z5YL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZRMYY#issuecomment-569579107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNGOFFCFYAEUDFKV6AWOJDQ3FZZPANCNFSM4J7Z5YLQ .

Thaina commented 4 years ago

@stowy My code is exactly the same as when using 1.0.0, it work fine. just import 1.2.2 into project make it cause this behaviour. So if this effect came from not initializing the Mobile Ads SDK then there would seem wrong

stowy commented 4 years ago

That's a fair comment.

The reason that I see the first log about MobileAds.initialize is because in version 1.2.0 we added version support which queries the MobileAds version for the AdMob adapter, and this causes the crash because you have not initialized MobileAds.

The second crash seems more problematic from our side, this seems to indicate an issue with the app ID. Are you launching the test suite using the MediationTestSuite.launch(context, appId) API, without including an appId in the android manifest? If so, that might explain the issue. But I'm surprised that your app is launching without having an app ID in the Android manifest, I would expect it to crash immediately by the Mobile Ads SDK detecting no app ID in the manifest.

On Sun, Dec 29, 2019 at 8:37 PM Thaina Yu notifications@github.com wrote:

@stowy https://github.com/stowy My code is exactly the same as 1.0.0 just import 1.2.2 into project make it cause this behaviour. So if this effect came from not initializing the Mobile Ads SDK then there would seem wrong

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/1121?email_source=notifications&email_token=ABNGOFGBRTFGPRCNOHKLV4TQ3F3HBA5CNFSM4J7Z5YL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZRZSI#issuecomment-569580745, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNGOFFSMV4D6DL2NY7WH6LQ3F3HBANCNFSM4J7Z5YLQ .

Thaina commented 4 years ago

@stowy Thanks for your suggestion. I would try those in my next workday

Thaina commented 4 years ago

Fixed. Thank you very much