gpt4 book ai didi

flutter - 任务 ':audioplayers:compileDebugKotlin' 执行失败

转载 作者:行者123 更新时间:2023-12-04 04:26:11 60 4
gpt4 key购买 nike

尝试将我的 Flutter 应用程序编译到 Android 模拟器时,我遇到了这个令人讨厌的错误。这是错误日志(太长,无法完全粘贴):

aunching lib/main.dart on sdk gphone x86 in debug mode...Running Gradle task 'assembleDebug'...Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.e: Incompatible classes were found in dependencies. Remove them fromthe classpath or use '-Xskip-metadata-version-check' to suppresserrors e:/Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/META-INF/kotlin-stdlib.kotlin_module:Module was compiled with an incompatible version of Kotlin. The binaryversion of its metadata is 1.5.1, expected version is 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:Module was compiled with an incompatible version of Kotlin. The binaryversion of its metadata is 1.5.1, expected version is 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:Module was compiled with an incompatible version of Kotlin. The binaryversion of its metadata is 1.5.1, expected version is 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): Unresolved reference: 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' was compiled with an incompatible versionof Kotlin. The binary version of its metadata is 1.5.1, expectedversion is 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): Class 'kotlin.Unit' was compiled with an incompatibleversion of Kotlin. The binary version of its metadata is 1.5.1,expected version is 1.1.15. The class is loaded from/Users/reinier/.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':audioplayers:compileDebugKotlin'.

Compilation error. See log for more details


  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
  • https://help.gradle.org 获得更多帮助

  • BUILD FAILED in 21s Exception: Gradle task assembleDebug failed with
    退出代码 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

    最佳答案

    更新到 build.gradle 中的较新 kotlin 版本似乎解决了我的问题。

    ext.kotlin_version = '1.4.32'
    Solution from a related question

    关于flutter - 任务 ':audioplayers:compileDebugKotlin' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67832028/

    60 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com