首页 > 解决方案 > 由于包“Audioplayers”而无法构建 APK

问题描述

我在我的应用程序中使用包 Flutter 音频播放器来播放来自 Google Cloud 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

标签: flutterdart

解决方案


据我所知,这是一个错误

与所有错误一样,您可以等待修复,也可以降级软件包,直到找到仍然有效的版本。

或者,您可以自己挖掘代码,修复它并打开一个拉取请求


推荐阅读