Hi AdMob Team,
I'm testing my integration of Mediation Ad Networks using the AdMob Mediation Test Suite.
However, I'm getting a launch activity error when trying to run the test suite in a real device (see images).
This is the error that is crashing the application:
05-11 20:36:58.145 12902-12902/com.xengar.android.wordcounter E/AndroidRuntime: FATAL EXCEPTION: main
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:677)
at android.app.ContextImpl.startActivity(ContextImpl.java:664)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
at com.google.android.ads.mediationtestsuite.MediationTestSuite.launchWithAppId(MediationTestSuite.java:70)
at com.google.android.ads.mediationtestsuite.MediationTestSuite.launch(MediationTestSuite.java:38)
at com.xengar.android.wordcounter.ui.MainActivity.launchMediationTestSuite(MainActivity.kt:101) at com.xengar.android.wordcounter.ui.HelpFragment.onOptionsItemSelected(HelpFragment.kt:86) at androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109)
at androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109)
at androidx.appcompat.widget.Toolbar$1.onMenuItemClick(Toolbar.java:207)
at androidx.appcompat.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:779)
at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:834)
at androidx.appcompat.view.menu.SubMenuBuilder.dispatchMenuItemSelected(SubMenuBuilder.java:90)
at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:158)
at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:985)
at androidx.appcompat.view.menu.MenuPopup.onItemClick(MenuPopup.java:128)
at android.widget.AdapterView.performItemClick(AdapterView.java:315)
at android.widget.AbsListView.performItemClick(AbsListView.java:1193)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3231)
at android.widget.AbsListView$3.run(AbsListView.java:4207)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:683)
My application configuration is like this:
- The application is in Android Studio with Kotlin.
- It has 1 ad banner at the bottom.
- It has 3 Ad Networks: AdMob, AppLovin and Facebook Audience Network.
- I'm using implementation 'com.google.android.ads:mediation-test-suite:1.3.0'
- All my libraries are the latest available
- Android Studio is the latest available
My test device is:
SLONE Pilot_S5004 (Android 6.0, API 23)
Notes:
- I launch the test suite from a button inside a fragment (HelpFragment.kt:86) which calls a function in the parent activity (MainActivity.kt:101)
- The function in (MainActivity.kt:101) is
fun launchMediationTestSuite() {
MediationTestSuite.launch(applicationContext)
}
The observed behaviour is:
- I can run the test suite fine in the emulator for my project.
- The AdNetworks integrations seem to be fine. I can see AdMob and Facebook Audience Network test ads.
2020-05-11 22:25:57.037 8583-8583/com.xengar.android.wordcounter E/AppLovinAdapter: Failed to load banner ad with error: 204
- When I run the application in a real device I can see the AppLovin banner. So, my guess is that my configuration is fine.
Probable fix:
Could you fix this?
Thanks,
Angel