【问题标题】:Unable to build APK due the package "Audioplayers"由于包“Audioplayers”而无法构建 APK
【发布时间】:2021-04-08 22:26:50
【问题描述】:

我在我的应用中使用 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

【问题讨论】:

  • 这是音频播放器包的一个错误,看看他们的 Github 问题

标签: flutter dart


【解决方案1】:

据我所知,是bug

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

或者,您可以自己挖掘code,修复它并打开pull request

【讨论】:

  • 非常感谢...我将软件包降级为0.16.2,它运行良好,没有任何错误...希望它会在下一个版本中得到修复。
  • 谢谢!降级到 0.16.2 也对我有用
【解决方案2】:

您可以尝试在 build.gradle 上将 ext.kotlin_version 升级到“1.4.21” 它对我有用! Github Discussion

【讨论】:

    【解决方案3】:

    正如@Teja 正确指出的那样,错误在于您的项目使用的是过时的 kotlin 版本,不支持尾随逗号等某些功能。

    真正的解决方法是更新您的应用配置(如上所述)。

    但是,为了避免混淆,我合并了这个 PR,它也会降级我们的代码,以便它可以在旧版本的 kotlin 上运行。已合并并在 0.17.3 及更高版本发布(目前我们在 0.17.4)。

    因此,这是固定的。没有理由再在您的应用上降级 AP。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-04-17
      • 1970-01-01
      • 1970-01-01
      • 2012-08-13
      • 2021-10-23
      • 2016-12-15
      • 1970-01-01
      相关资源
      最近更新 更多