Missing compileSdkVersion for google mobile ads


defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.ringit2"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName

Here is what I found on my build.gradle and I can’t find compileSdkVersion which I have to change to at least 28 in order for google mobile ads to operate.

After I added google_mobile_ads: ^1.1.0 on pubspec.yaml and imported the package to the main.dart, The app opens as I run the simulator but shuts down right away. Console shows me this message and it is stuck just like this forever.

Launching lib\main.dart on SM G950N in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...

Please note that my ext.kotlin_version is '1.6.10' because people have recommended to upgrade it


Also changed the distributionUrl…

enter image description here

Not sure why google mobile ads package is so hard to use even just to start but what should I change to use it?


I am also using kotlin version ‘1.6.10’ and compilesdk version is inside android>app>build.gradle

enter image description here

Answered By – Ahmad Raza

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *