2021年4月8日星期四

Android emulator doesn't run with Google Ad SDK Flutter

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  
https://stackoverflow.com/questions/67014144/android-emulator-doesnt-run-with-google-ad-sdk-flutter April 09, 2021 at 10:08AM

没有评论:

发表评论