当前位置: 首页 > article >正文

Flutter错误: uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared

前言

今天要做蓝牙通信的功能,我使用了flutter_reactive_ble这个库,但是在运行的时候发现一下错误

Launching lib/main.dart on AQM AL10 in debug mode...

/Users/macbook/Desktop/test/flutter/my_app/android/app/src/debug/AndroidManifest.xml Error:

    uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:reactive_ble_mobile] /Users/macbook/Desktop/test/flutter/my_app/build/reactive_ble_mobile/intermediates/merged_manifest/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 21,

        or use tools:overrideLibrary="com.signify.hue.flutterreactiveble" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:processDebugMainManifest'.

> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:reactive_ble_mobile] /Users/macbook/Desktop/test/flutter/my_app/build/reactive_ble_mobile/intermediates/merged_manifest/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 21,

        or use tools:overrideLibrary="com.signify.hue.flutterreactiveble" to force usage (may lead to runtime failures)

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐

│ The plugin reactive_ble_mobile requires a higher Android SDK version.                         │

│ Fix this issue by adding the following to the file                                            │

│ /Users/macbook/Desktop/test/flutter/my_app/android/app/build.gradle:                          │

│ android {                                                                                     │

│   defaultConfig {                                                                             │

│     minSdkVersion 21                                                                          

│   }                                                                                           │

│ }                                                                                             │

│                                                                                               │

│ Note that your app won't be available to users running Android SDKs below 21.                 │

│ Alternatively, try to find a version of this plugin that supports these lower versions of the │

│ Android SDK.                                                                                  │

│ For more information, see:                                                                    │

│ https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration          │

└───────────────────────────────────────────────────────────────────────────────────────────────┘

Exception: Gradle task assembleDebug failed with exit code 1

Exited

问题原因

自己项目的minSdkVersion比三方SDK的的minSdkVersion低,即版本不一致导致的。

解决办法

方法一

前往项目——>android——>app——>build.gradle文件搜索defaultConfig,将minSdkVersion修改成固定值即可

方法二

进入flutter环境安装目录/packages/flutter_tools/gradle(这里的flutter是环境变量中配置的flutter路径),搜索minSdkVersion,将值改为需求的版本即可(我这里改成21)


http://www.kler.cn/a/387179.html

相关文章:

  • docker构建jdk11
  • elementui el-table中给表头 el-table-column 加一个鼠标移入提示说明
  • MySQL系列之如何在Linux只安装客户端
  • nginx配置负载均衡详解
  • GxtWaitCursor:Qt下基于RAII的鼠标等待光标类
  • win32 / WTL 开发多线程应用,子线程传递大对象给UI线程(主窗口)的方法
  • Shortcut Learning in In-Context Learning: A Survey
  • MySQL 权限困境:从权限丢失到权限重生的完整解决方案20241108
  • Android Framework AMS(11)广播组件分析-2(注册/注销流程解读)
  • PDS的主要部件
  • 50个广泛使用的SQL关键字
  • 在 Ubuntu 上安装 Redis 并为其设置登录密码
  • go桌面框架Fyne最全api文档
  • PVE纵览-深入了解PVE中的防火墙功能
  • 数组和字符串的es6新方法使用和综合案例
  • 华为OD机试真题-矩形绘制
  • 跨线程GCHandle,如何使用PinnedIntArray等结构来管理内存,以及如何确保在处理完成后释放资源。
  • 软件知识:什么是软件工程?
  • 【前端】Svelte:组件封装与使用
  • 校园周边美食探索及分享平台
  • C#里使用预定义函数来对数组进行翻转
  • 美格智能5G车规级通信模组: 5G+C-V2X连接汽车通信未来十年
  • [产品管理-60]:产品的情感化设计与常用工具:感性工学、情感分析、神经网络法、微软反应卡、突发情绪法
  • jmeter结合ansible分布式压测--1数据准备
  • 使用docker形式部署jumpserver
  • oracle-函数-grouping sets(x1,x2,x3...)的妙用