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

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.lryc.cn/news/482191.html

相关文章:

  • Spark 的容错机制:保障数据处理的稳定性与高效性
  • TCP可靠连接的建立和释放,TCP报文段的格式,UDP简单介绍
  • LLMs之PDF:zeroX(一款PDF到Markdown 的视觉模型转换工具)的简介、安装和使用方法、案例应用之详细攻略
  • 开源数据库 - mysql - mysql-server-8.4(gtid主主同步+ keepalived热切换)部署方案
  • Java全栈体系路线
  • 【Unity基础】Unity中如何导入字体?
  • 使用NVIDIA GPU加速FFmpeg视频压制:完全指南
  • Python学习:scipy是什么?
  • spark的学习-05
  • SQL注入(SQL Injection)详解
  • 深入解析 OpenHarmony 构建系统-2-目录结构与核心组件
  • 网络安全应急响应(归纳)
  • 【网络协议栈】网络层(上)网络层的基本理解、IP协议格式、网络层分组(内附手画分析图 简单易懂)
  • 数据库类型介绍
  • 一步一步从asp.net core mvc中访问asp.net core WebApi
  • linux中kubectl命令使用
  • Linux 系统结构
  • ESP32-S3设备智能化升级,物联网无线AI语音交互,让生活更加便捷和有趣
  • Python的函数(补充浅拷贝和深拷贝)
  • oracle查询字段类型长度等字段信息
  • C语言 | Leetcode C语言题解之第559题N叉树的最大深度
  • 光流法(Optical Flow)
  • Rancher的安装
  • 【Linux】获得同一子网下当前在线设备IP/Latency/MAC 通过nmap指定CIDR扫描当前在线设备
  • Ubuntu22.04安装DataEase
  • Taro React-Native IOS 打包发布
  • 【卷积神经网络CNN】基于深度学习动物图像识别系统(完整系统源码+数据库+开发笔记+详细部署教程+启动教程)✅
  • 图像处理椒盐噪声
  • 推荐一款完全开源的多端仓库管理系统
  • python 爬虫 入门 六、Selenium