绕过 Min SDK 版本 - 或者其他什么?
Bypass Min SDK Version - or what else?
我从 flutter 开始,总的来说,我有了一个想法,但遇到了困难,我发现这是考虑从 HTML + JQueryMobile 迁移的主要原因之一:语音到文本实施。
我找到了 speech_to_text 包 (https://pub.dev/packages/speech_to_text#-installing-tab-),按照说明进行操作:
1. 使用依赖项更新 pubspec.yaml 文件 &
2.从命令行安装包
3.在代码中导入包
但是由于软件包不满足最低 SDK 要求而碰壁。这是错误消息:
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml
Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 21
declared in library [:speech_to_text]
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_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.csdcorp.speech_to_text" to force usage (may
lead to runtime failures)
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 21 declared in library [:speech_to_text]
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_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.csdcorp.speech_to_text" to force usage (may lead to runtime failures)
尝试:运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
获取更多帮助
11 秒内构建失败异常:Gradle 任务 assembleDebug 失败,显示
退出代码 1
奇怪,我成功绕过了一次,但找不到
现在应用程序文件夹中的相关代码段。更糟糕的是,提到的文件
> C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml
does not contain any reference to SDK, only this:
< <manifest
<xmlns:android="http://schemas.android.com/apk/res/android"
< package="com.example.flutter4">
> <!-- Flutter needs it to communicate with the running application
> to allow setting breakpoints, to provide hot reload, etc.
> -->
> <uses-permission android:name="android.permission.INTERNET"/> </manifest>
As for the other mentioned file, which looks like this:
> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.csdcorp.speech_to_text" >
>
> <uses-sdk android:minSdkVersion="21" />
>
> </manifest>
尝试 运行 此应用程序后,将 21 更改为 16 将恢复。
如何处理
1. 技术上,即。此 minSDK 限制的解决方法是什么 - 至少值得一试?
2. 退一步说,如果有版本问题,如何避免?
非常感谢
编辑应用程序文件夹中的 build.gradle 文件。搜索 defaultConfig
,将 minSdkVersion
从 16 编辑为 21。
文件路径。
android\app\build.gradle
我从 flutter 开始,总的来说,我有了一个想法,但遇到了困难,我发现这是考虑从 HTML + JQueryMobile 迁移的主要原因之一:语音到文本实施。
我找到了 speech_to_text 包 (https://pub.dev/packages/speech_to_text#-installing-tab-),按照说明进行操作: 1. 使用依赖项更新 pubspec.yaml 文件 & 2.从命令行安装包 3.在代码中导入包
但是由于软件包不满足最低 SDK 要求而碰壁。这是错误消息:
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:speech_to_text] C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_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.csdcorp.speech_to_text" to force usage (may lead to runtime failures)
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 21 declared in library [:speech_to_text] C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_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.csdcorp.speech_to_text" to force usage (may lead to runtime failures)
尝试:运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
- 获取更多帮助
11 秒内构建失败异常:Gradle 任务 assembleDebug 失败,显示 退出代码 1
奇怪,我成功绕过了一次,但找不到 现在应用程序文件夹中的相关代码段。更糟糕的是,提到的文件
> C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml
does not contain any reference to SDK, only this:
< <manifest
<xmlns:android="http://schemas.android.com/apk/res/android"
< package="com.example.flutter4">
> <!-- Flutter needs it to communicate with the running application
> to allow setting breakpoints, to provide hot reload, etc.
> -->
> <uses-permission android:name="android.permission.INTERNET"/> </manifest>
As for the other mentioned file, which looks like this:
> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.csdcorp.speech_to_text" >
>
> <uses-sdk android:minSdkVersion="21" />
>
> </manifest>
尝试 运行 此应用程序后,将 21 更改为 16 将恢复。
如何处理 1. 技术上,即。此 minSDK 限制的解决方法是什么 - 至少值得一试? 2. 退一步说,如果有版本问题,如何避免? 非常感谢
编辑应用程序文件夹中的 build.gradle 文件。搜索 defaultConfig
,将 minSdkVersion
从 16 编辑为 21。
文件路径。
android\app\build.gradle