我在我的应用程序中使用软件包 flutter 音频播放器来播放来自谷歌云 tts 的音频。 它在 iOS 模拟器上运行良好,但是当我构建 apk 时出现以下错误:
e: /Users/josuha/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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: /Users/joshua/Documents/flutter/.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:compileReleaseKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 8.7s
Gradle task assembleRelease failed with exit code 1
预先感谢您的帮助。
答案 0 :(得分:8)
答案 1 :(得分:5)
您可以尝试在 build.gradle 上将 ext.kotlin_version 升级到 '1.4.21' 它对我有用! Github Discussion
答案 2 :(得分:1)
正如@Teja 正确指出的那样,错误在于您的项目使用的是过时的 kotlin 版本,该版本不支持尾随逗号等某些功能。
真正的解决方法是更新您的应用配置(如上所述)。
然而,为了避免混淆,我合并了这个 PR,它也降级了我们的代码,以便它可以在旧版本的 kotlin 上运行。已在 0.17.3 及更高版本合并和发布(目前我们在 0.17.4)。
因此,这是固定的。没有理由再在您的应用上降级 AP。