admob_flutter
admob_flutter copied to clipboard
Loading banner ads freezes the app / restarts the phone on certain devices
I've had this issue reported from quite a few users with LG Stylo 6 and T-mobile Revvl 4. Removing the banner ads fixed the problem for them. I don't have those devices so it's impossible to properly test what's going on. My Flutter version is 1.22.5 stable.
Sample code of the ad used in the app:
static buildBanner() {
AdmobBanner banner = AdmobBanner(
adUnitId: BANNER_UNIT_ID_ANDROID,
adSize: AdmobBannerSize.BANNER,
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
if (event == AdmobAdEvent.failedToLoad) {
print("Error code: ${args['errorCode']}");
}
},
);
return Padding(
padding: const EdgeInsets.only(top: 2.0),
child: Center(child: banner),
);
}
i have the same problem, i think it this package causes memory leak.
I had this issue when using with Firebase packages and a certain version of it.
I fixed this problem by setting FirebaseSDKVersion
in app/build.gradle
Perhaps newer versions work too, but I didn't test those.
rootProject.ext { set('FlutterFire', [ FirebaseSDKVersion: '26.2.0' ]) }