Skip to content

Fatal Exception: java.lang.LinkageError with Flutter and AdMob

Dart, Flutter, Issues1 min read

I upgraded the Google Mobile Ads SDK in my app a couple of weeks ago and I started noticing lately that I'm getting some 'LinkageError' errors in my Crashlytics Dashboard. Apparently this is kind of a Google Mobile Ads issues more than a Flutter issue(or more specifically a Gradle issue). For reference I am still using Flutter 2.10.5 in this particular app. Weirdly enough I didn't have this issue at all until I upgraded my google_mobile_ads dependency.

It seems easy enough to fix though. I did some searching and it looks like it's just a matter of upgrading the version of your Android Gradle Plugin. You can change this in your project level build.gradle file(this will be inside your 'android' folder if you're using Flutter). This is what I had:

1classpath ''

According to one of the GitHub issues about this topic, you only need to upgrade this to 4.2.2(alternatively you can also upgrade to 7.x.x and it will also fix the issues). So this is what I changed mine to:

1classpath ''

Now all you need to do is do some quick testing and make sure everything works properly and then upload your new version to Google Play. Hopefully you're not stuck in the review queue for too long!