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

不幸的是,当试图运行(在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与颤振,以及如何?


当前回答

对于颤振v2.8

在当地。属性添加

sdk.dir='<path>'
flutter.sdk='<path>'
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

flutter.minSdkVersion=21
flutter.targetSdkVersion=30
flutter.compileSdkVersion=30

app-level build.gradle

defaultConfig {
    minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
    targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

现在可以使用localProperties.getProperty()从属性文件中读取值。

其他回答

对于颤振v2.8

在当地。属性添加

sdk.dir='<path>'
flutter.sdk='<path>'
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

flutter.minSdkVersion=21
flutter.targetSdkVersion=30
flutter.compileSdkVersion=30

app-level build.gradle

defaultConfig {
    minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
    targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

现在可以使用localProperties.getProperty()从属性文件中读取值。

它在[project_name]/android/app/build.gradle的defaultconfig中找到。defaultconfig

将您编译的sdk版本升级到29或更高

希望这对你有所帮助。

应用程序/构建。Gradle添加此版本代码

按照以下步骤更改minSdkVersion问题。

第一次= > YouProject_name / android / app / build.gradle

Second=> defaultconfig{//你可以在build中找到它。gradle}

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.umair.product_details_using_crud"
        minSdkVersion 16 // here you can change minSdkVersison
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }