更新:使用sdk:minSdkVersion 16不能小于库[:cloud_firestore]中声明的版本19



android/app/build.gradle


defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "cmon.com"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

错误:

G:FluttercmonandroidappsrcdebugAndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] G:Fluttercmonbuildcloud_firestoreintermediatesmerged_manifestdebugAndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="io.flutter.plugins.firebase.firestore" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.

如何修改上述给定的默认版本。这个错误的原因是什么?

您可以手动添加类似的最低sdk版本

defaultConfig {
applicationId "cmon.com"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

在Android Studio项目中,您必须编辑build.gradle文件。在颤振项目中,它位于路径./android/app/build.gradle处。

minSdkVersion中需要更改的参数为19

defaultConfig {
applicationId "com.example.myapplication"
//This is the part that needs to be changed, previously was 16
minSdk 19 
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

Android SDK 16-18只是一个尽力而为的平台
最大努力意味着通过社区测试来支持,我们相信我们通过编码实践和特别测试来支持这些平台,但依赖社区进行测试。

这是参考链接
https://docs.flutter.dev/development/tools/sdk/release-notes/supported-platforms#supported-谷歌测试平台

在您的android/app/build.gradle flie中,

注释此行-minSdkVersion flutter.minSdkVersion
,然后只添加minSdkVersion 21flutter.minSdkVersion=21

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

最新更新