uses-sdk:minSdkVersion 16 不能小于库中声明的版本 23
Posted
技术标签:
【中文标题】uses-sdk:minSdkVersion 16 不能小于库中声明的版本 23【英文标题】:uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library 【发布时间】:2021-04-10 16:32:06 【问题描述】:我想使用一个颤振包“audioplayers”,但是当我运行我的代码时出现这个错误
C:\Users\Utilisateur\androidStudioProjects\xylophone_flutter\android\app\src\debug\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [:audioplayers] C:\Users\Utilisateur\AndroidStudioProjects\xylophone_flutter\build\audioplayers\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 23,
or use tools:overrideLibrary="xyz.luan.audioplayers" 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 23 declared in library [:audioplayers] C:\Users\Utilisateur\AndroidStudioProjects\xylophone_flutter\build\audioplayers\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 23,
or use tools:overrideLibrary="xyz.luan.audioplayers" to force usage (may lead to runtime failures)
当我将 myApp/android/app/build.gradle
上的 minSdkVersion 16
更改为 23 时,我又遇到了一个错误
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (181, 52): Expecting a parameter declaration
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (231, 38): Expecting an argument
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\ByteDataSource.kt: (8, 37): Expecting a parameter declaration
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedMediaPlayer.kt: (10, 39): Expecting a parameter declaration
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (168, 32): Expecting a parameter declaration
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (205, 26): Expecting an argument
e: C:\Users\Utilisateur\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (46, 77): Type inference failed. Expected type mismatch: inferred type is List<???> but MutableList<WrappedSoundPool> was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log for more details
如何解决?
【问题讨论】:
github.com/luanpotter/audioplayers/issues/720 【参考方案1】:您需要编辑位于项目目录中的build.gradle
文件,如your_project_folder\android\app\build.gradle
并找到并将此行minSdkVersion 16
编辑为minSdkVersion 23
,然后使用flutter clean
命令保存文件并运行强>它。
defaultConfig 在 build.gradle 文件中应如下所示
defaultConfig
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.your_package_name_here"
minSdkVersion 23
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
希望上述解决方案能奏效。
或者更好地使用旧版本的音频播放器。 在您的 pubspec.yaml 文件中编辑
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
audioplayers: ^0.10.0
【讨论】:
使用这个版本.. 音频播放器:^0.10.0 也适用于 react-native :)【参考方案2】:我遇到了类似的问题,在 build.gradle 中更改 SDK 版本并没有解决问题。 我只是降级到音频播放器:0.17.0,请确保删除 0 之前的 ^。它应该适合你
【讨论】:
在 mi case/ 中没有解决问题它说:因为 audioplayers >=0.16.2 =0.16.2以上是关于uses-sdk:minSdkVersion 16 不能小于库中声明的版本 23的主要内容,如果未能解决你的问题,请参考以下文章
uses-sdk:minSdkVersion 16 不能小于库 [:audioplayers] 中声明的版本 23
flutter_smart_cropper uses-sdk:minSdkVersion 16 不能小于库中声明的版本 19
关于Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 16 declared in li
Manifest merger failed:uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in libra