我正在尝试为一个使用蓝牙通信的应用程序启动一个颤振项目。我用的是颤振蓝。

不幸的是,当试图运行(在Android设备上)我创建的第一个示例时,我遇到了以下错误:

FAILURE: Build failed with an exception.

  * What went wrong:
  Execution failed for task ':app:processDebugManifest'.
  > Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:flutter_blue] /home/maldus/Projects/flutter/polmac/build/flutter_blue/intermediates/manifests/full/debug/AndroidManifest.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="com.pauldemarco.flutterblue" to force usage (may lead to runtime failures)

如果我在Android Studio,我知道如何提升Android minSdkVersion,但在一个flutter项目(使用VSCode),我有点迷失。

是否有可能增加minSdkVersion与颤振,以及如何?


当前回答

defaultConfig { // TODO:指定您自己唯一的应用程序ID (https://developer.android.com/studio/build/application-id.html)。 applicationId“com.example.map” minSdkVersion 19 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger () versionName flutterVersionName }

其他回答

你可以在Project_Name/android/app/build文件中修改minSdkVersion。Gradle, defaultconfig:

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.projectname"
    minSdkVersion 16 // <--- There
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
    **android/local.properties**
flutter.versionCode=1
flutter.minSdkVersion=21
flutter.targetSdkVersion=30
flutter.compileSdkVersion=31

  **android/app/build.gradle**
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()

targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

当我最近遇到这个问题时,我是这样处理的:

在<项目> / android / app / build.gradle

找到android -> defaultConfig -> minSdkVersion并将其替换为

minSdkVersion Math . max(扑动。minSdkVersion, 21)

这里的21可以替换为你想要的最小版本。

如果flutter开始支持23或其他更高版本作为最低版本,并且您决定为项目升级flutter,那么它仍然可以工作。

第一次运行 颤振清洁

然后在Project_Name/android/app/build文件中修改minSdkVersion。Gradle, defaultconfig:

在android/app/build中试试这个。graddel minSdkVersion 30应该修复它,但要确保你的kotlin版本在kotlin_version = '1.6.10'。