I was trying to use Google Ad SDK for Flutter (google_mobile_ads 0.12.1) to display banner ads. I followed every step on the document (and iOS works perfectly). However when I tried to run the app on Android, the emulator doesn't launch. I simplified my code to the most and find that just adding the sdk package would hang up my emulator. My steps are now really simple:

  1. Created a new project (Yes, the counting app with floating button). App was built and run successfully on Android emulator.
  2. Added the google_mobile_ads 0.12.1 package and did pub get.
  3. Changed the minSdkVersion value in android/app/build.gradle to 19 so that it meets the requirement of Google Mobile Ad SDK.

Now try to build and run, the emulator got stuck. It was built, didn't crash, but could never finish installing. Debug console did show warnings of files using deprecated APIs:

Launching lib/main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...

And that's pretty much it. Stuck there forever. I have been looking around but couldn't find any helpful information yet. Could it be something within Google Ad SDK?

I'm using -

Android Studio 4.1.3
Emulator: Nexus 6 API 28
Flutter SDK version: Flutter 2.0.4 • channel stable
google_mobile_ads 0.12.1


Solution 1: Angela_Woo

Figured it out. The AndroidManifest.xml has to be configured correctly otherwise the app would crash. In my original app, the meta data needs to be in application level, but I accidentally added it in activity level.

meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="xx-xxxx-xxxx-xxxxxxx-xxxx"

And once this is corrected, problem resolved. Simple but took me some time. Hopefully this will be helpful for newbies like me.