Reputation: 123
Thanks for reading my question.
I hope you have a good day!
So my question is when I run my flutter project with android emulator, the error message below is shown.
The plugin google_mobile_ads requires a higher Android SDK version.
Fix this issue by adding the following to the file /Users/ahnjunhyun/FlutterProjects/dubu_timer/android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 19
}
}
Note that your app won't be available to users running Android SDKs below 19.
Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.
So I changed minSdkVersion
to minSdkVersion 19
.
Then I got an another error like below!
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/ahnjunhyun/FlutterProjects/dubu_timer/android/app/build.gradle' line: 47
* What went wrong:
A problem occurred evaluating project ':app'.
> Cannot get property '19' on null object
Is there someone who had same problem or knows how to fix?
I need your help
Upvotes: 1
Views: 2835
Reputation: 2501
Maybe you have typed '19' as a String not an integer so please have a look.
Upvotes: 0
Reputation: 493
You must to update minSdkVersion 19 to 21 in order to use google_mobile_ads.
defaultConfig {
applicationId "io.flutter.plugins.googlemobileadsexample"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Upvotes: 1