> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore]

huangapple go评论74阅读模式
英文:

> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore]

问题

我正在尝试在我的Flutter项目中添加cloud_firestore:^4.8.3,但当我尝试使用命令flutter run运行项目时,它显示以下错误:

> Manifest merger failed: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] /Users/medyassinemessaoud/Documents/EspritSim/flutter/examples/delivery-1/build/cloud_firestore/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16

因此,我的build.gradle文件如下:

def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
  flutterMinSdkVersion = 23
}

defaultConfig {
        applicationId "com.example.deliveryapp"
        minSdkVersion flutterMinSdkVersion
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

同时,local.properties文件如下:

flutter.compileSdkVersion=23

但仍然出现相同的错误,我该如何修复它?

英文:

I am trying to add the cloud_firestore: ^4.8.3 in my flutter project , but when I try to run the project with the command flutter run it displays to me this error:

> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] /Users/medyassinemessaoud/Documents/EspritSim/flutter/examples/delivery-1/build/cloud_firestore/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16

Such that my build.gradle is like that:

def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
  flutterMinSdkVersion = 23
}

 defaultConfig {
        applicationId "com.example.deliveryapp"
        minSdkVersion flutterMinSdkVersion
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

also the local.properties is like that:

flutter.compileSdkVersion=23
But with the same error, how can I fix it?

答案1

得分: 1

你需要将minSDK从

minSdkVersion flutterMinSdkVersion

 defaultConfig {
        applicationId "com.example.deliveryapp"
        minSdkVersion 21 //这里
英文:

You need to change the minSDK from

> minSdkVersion flutterMinSdkVersion

 defaultConfig {
        applicationId "com.example.deliveryapp"
        minSdkVersion 21 //this

答案2

得分: 0

cloud_firestore库中的AndroidManifest.xml文件中声明的minSdkVersion已设置为19,而您的Flutter项目的minSdkVersion设置为16。这会导致冲突,因为您的项目的最低SDK版本低于库要求的版本。

请更新您的项目的minSdkVersion以满足cloud_firestore库的要求。在您的build.gradle文件中,将minSdkVersion更改为19或更高:

defaultConfig {
    // ...
    minSdkVersion 19 //至少设置为19或更高
    // ...
}

如果您必须保持项目的minSdkVersion为16,您可以尝试使用支持SDK 16的较旧版本的cloud_firestore库。您可以修改您的pubspec.yaml文件以指定较低的版本:

dependencies:
  cloud_firestore: ^2.5.4
英文:

The minSdkVersion declared in the AndroidManifest.xml file of the cloud_firestore library is set to 19, while your Flutter project's minSdkVersion is set to 16. This conflict occurs because your project's minimum SDK version is lower than what the library requires.

Update your project's minSdkVersion to meet the requirements of the cloud_firestore library. In your build.gradle file, change the minSdkVersion to 19 or higher:

defaultConfig {
    // ...
    minSdkVersion 19 //at least 19 or higher
    // ...
}

If you must maintain a minSdkVersion of 16 for your project, you can try using an older version of the cloud_firestore library that supports SDK 16. You can modify your pubspec.yaml file to specify a lower version:

dependencies:
  cloud_firestore: ^2.5.4

答案3

得分: 0

在文件local.properties中,更改

flutter.minSdkVersion=19

或者尝试升级其他依赖项:

  • 删除文件pubspec.lock
  • flutter clean & flutter pub get
英文:

In file local.properties, change

> flutter.minSdkVersion=19

Or maybe try to upgrate other dependencies:

  • remove file pubspec.lock
  • flutter clean & flutter pub get

huangapple
  • 本文由 发表于 2023年7月18日 01:20:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76706762.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定