Flutter App crashes when "google_mobile_ads: ^2.3.0" is added into pubspec.yaml

565 views
Skip to first unread message

Shrimpu

unread,
Jan 4, 2023, 3:24:01 AM1/4/23
to Google Mobile Ads SDK Developers

So I want to put ads into my app. I followed the instructions from (https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/banner/get-started) and added everything from the docs. When ever I run the app it stops at

Running Gradle task 'assembleDebug'... √ Built build\app\outputs\flutter-apk\app-debug.apk.

then the app crashes.

Here the pubspec, AndroidManifest and main.dart:

pubspec.yaml:
```

google_mobile_ads: ^2.3.0

```
 ```

AndroidManifest.xml:

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
```
```

and main.dart:

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
MobileAds.instance.initialize();
await Firebase.initializeApp();

runApp(const MyApp(
backgroundColor: Colors.black,
));
}
```

The app runs without the

google_mobile_ads: ^2.3.0

Others:

```

minSdkVersion 23
compileSdkVersion 33
implementation 'com.google.android.gms:play-services-ads:7.5.0'
implementation 'com.android.support:multidex:1.0.3'
```

I Tried removing each code from the docs starting from

MobileAds.instance.initialize();

and running it each time. Found out that the

google_mobile_ads: ^2.3.0

Was the one causing it.

Im new to this so any help is appreciated

Mobile Ads SDK Forum Advisor

unread,
Jan 4, 2023, 5:22:09 AM1/4/23
to ultimate...@gmail.com, google-adm...@googlegroups.com

Hi Shrimpu,

 

Thank you for reaching out to us,

 

With regard to your concern, since you've mentioned that you're encounter crashes on Flutter with the version 2.3.0, I would suggest to create your concern in Flutter plugin issue tracker to assist you better on the crashes that you've encountering.

 

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2hZQKx:ref
Reply all
Reply to author
Forward
0 new messages