首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >uses-sdk:minSdkVersion 16不能小于库中声明的版本23

uses-sdk:minSdkVersion 16不能小于库中声明的版本23
EN

Stack Overflow用户
提问于 2021-01-05 05:37:44
回答 2查看 10.4K关注 0票数 10

我想使用flutter包'audioplayers‘,但是当我运行我的代码时,我得到了这个错误

代码语言:javascript
运行
复制
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时,我又遇到了另一个错误

代码语言:javascript
运行
复制
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

如何解决?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-01-06 22:44:03

您需要编辑位于项目目录(如your_project_folder\android\app\build.gradle )中的build.gradle文件,找到并编辑minSdkVersion 16 to minSdkVersion 23这一行,然后使用flutter clean命令保存该文件并运行 it。

defaultConfigbuild.gradle文件中应如下所示

代码语言:javascript
运行
复制
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文件中编辑

代码语言:javascript
运行
复制
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  audioplayers: ^0.10.0
票数 18
EN

Stack Overflow用户

发布于 2021-01-23 20:00:48

我也遇到过类似的问题,在build.gradle中更改SDK版本并没有解决这个问题。我只是简单地降级到audioplayers: 0.17.0,一定要去掉0前面的^。它应该能为你工作

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65570180

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档