flutter - 任务“:audioplayers:compileDebugKotlin”执行失败
问题描述
尝试将我的 Flutter App 编译到 Android 模拟器中时,我遇到了这个令人讨厌的错误。这是错误日志(太长,无法完全粘贴):
在调试模式下在 sdk gphone x86 上启动 lib/main.dart... 运行 Gradle 任务 'assembleDebug'... 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。e:在依赖项中发现不兼容的类。从类路径中删除它们或使用“-Xskip-metadata-version-check”来抑制错误 e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5。 10.jar!/META-INF/kotlin-stdlib.kotlin_module:模块是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是 1.5.1,预期版本是 1.1.15。e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/4d4ccf1034ba5937e6e7ba3aa34d2661/jetified-core-ktx-1.6.0-beta02-api.jar!/META-INF/core-ktx_release.kotlin_module: 模块是使用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是 1.5.1,预期版本是 1.1.15。e: /Users/reinier/.gradle/caches/transforms-2/files-2.1/77bab1911042ab2c6d5cc0b2e2ee053c/jetified-kotlin-stdlib-common-1.5.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: 模块使用不兼容的 Kotlin 版本编译。其元数据的二进制版本是 1.5.1,预期版本是 1.1.15。e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (18 , 32): 未解决的参考: mutableMapOf e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/ audioplayers/AudioplayersPlugin.kt: (25, 9): Class 'kotlin.Unit' 使用不兼容的 Kotlin 版本编译。其元数据的二进制版本是 1.5.1,预期版本是 1.1.15。
. . . . .
e: /Users/reinier/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/WrappedSoundPool.kt: (235 , 30): 类 'kotlin.Unit' 是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是 1.5.1,预期版本是 1.1.15。该类从 /Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class 加载
FAILURE:构建失败并出现异常。
- 出了什么问题:任务“:audioplayers:compileDebugKotlin”执行失败。
编译错误。有关详细信息,请参阅日志
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
在https://help.gradle.org获得更多帮助
BUILD FAILED in 21s Exception: Gradle task assembleDebug failed with exit code 1
- 我已经尝试在 android/app/build.gradle:38 将“minSdkVersion 16”更改为“minSdkVersion 23”,但无法正常工作。
- 尝试使用 0.17.0 版本的音频播放器和相同的版本,但不起作用。
- 尝试使用音频播放器的 ^0.10.0 版本,但什么也没有。
- 尝试执行前面的步骤,然后在终端上执行:flutter clean & flutter pub get... 什么都没有。
- 我已经更新了 Flutter SDK,什么也没更新。仍然不适用于Android。
它可以在 IOS 模拟器上完美编译。每次音频播放器包更新后,此错误已多次出现。我在 Android Studio 4.2.1 上使用 compileSdkVersion 30
这是我的 pubspec.yaml 文件:
name: feeddy_flutter
description: A multi screen foods listing Flutter app
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
intl: ^0.17.0
uuid: ^3.0.4
currency_text_input_formatter: ^2.0.1
date_time_picker: ^2.0.0
rflutter_alert: ^2.0.2
faker: ^1.3.0
fl_chart: ^0.35.0
provider: ^5.0.0
tinycolor: ^1.0.3
font_awesome_flutter: ^9.0.0
audioplayers: ^0.18.3
empty_widget: ^0.0.2
splashscreen: ^1.3.5
native_device_orientation: ^1.0.0
sqflite: ^2.0.0+3
flutter_switch: ^0.3.1
flutter_colorpicker: ^0.4.0
enum_to_string: ^2.0.1
humanizer: ^0.0.2
route_observer_mixin: ^1.5.0+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/audio/
fonts:
- family: Luminari
fonts:
- asset: assets/fonts/Luminari/Luminari-Regular.ttf
style: normal
weight: 500
- asset: assets/fonts/Luminari/Luminari-Regular.woff
style: normal
weight: 500
- family: SourceSansPro
fonts:
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf
style: normal
weight: 500
- family: OpenSans
fonts:
- asset: assets/fonts/OpenSans/OpenSans-Regular.ttf
style: normal
weight: 500
- asset: assets/fonts/OpenSans/OpenSans-Bold.ttf
weight: 700
- family: Quicksand
fonts:
- asset: assets/fonts/Quicksand/Quicksand-Regular.ttf
style: normal
weight: 500
- asset: assets/fonts/Quicksand/Quicksand-Medium.ttf
- asset: assets/fonts/Quicksand/Quicksand-Light.ttf
- asset: assets/fonts/Quicksand/Quicksand-Bold.ttf
weight: 700
- family: Raleway
fonts:
- asset: assets/fonts/Raleway/Raleway-Regular.ttf
style: normal
weight: 500
- asset: assets/fonts/Raleway/Raleway-Bold.ttf
weight: 700
- asset: assets/fonts/Raleway/Raleway-Black.ttf
weight: 900
- family: RobotoCondensed
fonts:
- asset: assets/fonts/RobotoCondensed/RobotoCondensed-Regular.ttf
style: normal
weight: 500
- asset: assets/fonts/RobotoCondensed/RobotoCondensed-Bold.ttf
weight: 700
- asset: assets/fonts/RobotoCondensed/RobotoCondensed-Light.ttf
weight: 300
- asset: assets/fonts/RobotoCondensed/RobotoCondensed-Italic.ttf
style: italic
- family: AppIcons
fonts:
- asset: assets/fonts/AppIcons/AppIcons.ttf
解决方案
推荐阅读
- c++ - C++ lambda capture result
- api - 将曲目上传到 Apple Music (API)
- sparql - 查询多个子类属性
- amazon-web-services - AWS Glue 爬虫未使用内置分类器为固定长度文本文件创建表
- javascript - 迁移到 Meteor 1.7 会导致 Unknown provider: Meteor.userId( Exception
- c# - 如何将显示文本和单击事件添加到在 Unity 运行时创建的动态预制对象
- wordpress - WP 在显示管理员帖子之前优先显示作者的帖子
- python - 如何使用字典包含列表附加字典
- javascript - 用图像替换警报功能
- elasticsearch - 弹性搜索 - 我们如何计算给定字段和动态字段之间的年龄