我试图为一个使用蓝牙进行通信的应用程序启动一个Flutter项目。为此,我使用了颤动的蓝色。
不幸的是,当尝试运行(在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的性能,但是在一个扑朔迷离的项目中(使用VSCode),我有点迷失了。
有可能随着颤动增加minSdkVersion,怎么办?
确实有可能增加minSdkVersion,但是我花了太多时间才找到它,因为google搜索主要是收益,因为关于绝对最小Sdk版本抖动的结果讨论应该能够支持,而不是如何在您自己的项目中增加它。
就像在Android Studio项目中一样,您必须编辑build.gradle文件。在颤动的项目中,可以在path中找到它./android/app/build.gradle。
build.gradle
./android/app/build.gradle
当然,需要更改的参数是将minSdkVersion 16其增加到所需的值(在本例中为19)。
minSdkVersion 16
defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.projectname" minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }
现在看来很明显,但是花了我足够长的时间自己解决。