我试图为使用蓝牙进行通信的应用程序启动一个颤振项目。为此,我使用了 flutter blue 。
不幸的是,在尝试运行(在 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,以及如何增加?
原文由 Maldus 发布,翻译遵循 CC BY-SA 4.0 许可协议
确实可以增加 minSdkVersion,但是我花了太多时间才找到它,因为 google 搜索大多产生关于 Flutter 应该能够支持的绝对最低 Sdk 版本的讨论结果,而不是如何在你自己的项目中增加它.
就像在 Android Studio 项目中一样,您必须编辑
build.gradle
文件。在一个颤振项目中,它位于路径./android/app/build.gradle
。当然,需要更改的参数是
minSdkVersion 16
,将其增加到您需要的参数(在本例中为 19)。现在看起来很明显,但我花了足够长的时间才自己弄清楚。