I tried installing audioplayers: ^0.17.1
and ran my flutter project. It throws the following error. Can someone help, please?
e: C:\Users\User\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: C:\Users\User\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: C:\Users\User\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: C:\Users\User\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: C:\Users\User\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: C:\Users\User\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: C:\Users\User\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:compileDebugKotlin'.
> 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 37s
Exception: Gradle task assembleDebug failed with exit code 1
I had been struggling with this issue since morning and finally here are 2 fixes:
Upgrade to flutter 2.0 and then update audioplayers dependency to 0.19.0 in pubspec.yaml
*in the build.gradle change ext.kotlin_version to '1.4.32'
or
If you don't want to upgrade to flutter 2.0 due to some reasons then downgrade your audioplayers dependency to ^0.16.0.
Note: To update Flutter SDK use the flutter upgrade
command.
The current latest version is 0.18.0, but I faced the same problem. And I could solve that problem by following Gradle Build Failing.
In order to support the playBytes method, this has a hard requirement on using API >= 23 features, and your build may failure depending on your minimum SDK targeting. To override this, you will need to add
<uses-sdk tools:overrideLibrary="xyz.luan.audioplayers"/>
to your AndroidManifest.xml file.
If you still facing an error on the compiling, you should change version of kotline following this issue.
faced same issue, fixed by updating ext.kotlin_version to 1.4.31 in android/build.gradle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With