简体   繁体   English

flutter - android minSdkVersion 不断出错

[英]flutter - android minSdkVersion keeps making an error

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.所以我的问题是,当我使用 android 仿真器运行我的 flutter 项目时,会显示以下错误消息。

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 .所以我将minSdkVersion更改为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我需要你的帮助

You must to update minSdkVersion 19 to 21 in order to use google_mobile_ads.您必须将 minSdkVersion 19 更新到 21 才能使用 google_mobile_ads。

    defaultConfig {
      applicationId "io.flutter.plugins.googlemobileadsexample"
      minSdkVersion 21
      targetSdkVersion 31
      versionCode flutterVersionCode.toInteger()
      versionName flutterVersionName
      testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Reference: https://github.com/googleads/googleads-mobile-flutter/blob/master/packages/google_mobile_ads/example/android/app/build.gradle参考: https://github.com/googleads/googleads-mobile-flutter/blob/master/packages/google_mobile_ads/example/android/app/build.gradle

Maybe you have typed '19' as a String not an integer so please have a look.也许您输入了“19”作为字符串而不是 integer,所以请看一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM