'Flutter - "Finished with error: The plugin assets_audio_player could not be built due to the issue above."
I got this error when i try to run my app. The real question that i wanted to ask, this project works on my macOS, but my windows pc can't run it.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Nexoft\Desktop\flutter\.pub-cache\hosted\pub.dartlang.org\assets_audio_player-1.4.2\android\build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':assets_audio_player'.
Plugin with id 'kotlin-android' not found.
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 2s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin assets_audio_player...
Running Gradle task 'assembleAarRelease'...
Unzipping C:\Users\Nexoft\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1-all.zip to C:\Users\Nexoft\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx
Finished with error: The plugin assets_audio_player could not be built due to the issue above.
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
The things i tried:
- flutter clean
- flutter pub repair
- pub upgrade
- different versions of gradle.build
My pubspec.yaml libs:
cupertino_icons: ^0.1.2
assets_audio_player: 1.4.2
easy_localization: 1.3.1
shared_preferences: ^0.5.3+1
flutter_icons: ^0.1.4
sprintf: ^4.0.0
firebase_admob: 0.9.3+2
launch_review: ^2.0.0
flutter_launcher_icons: ^0.7.2
numberpicker: ^1.0.0
flutter_spinkit: ^3.1.0
flutter_local_notifications: ^0.8.2
flutter_datetime_picker: ^1.3.1
screen: ^0.0.5
path_provider: ^1.5.1+1
fl_chart: ^0.7.0
flutter_email_sender: ^2.0.3
audioplayer: 0.5.2
audio: 0.0.5
flutter_animation_progress_bar: ^1.0.0
slide_countdown_clock: ^1.0.3
youtube_player_flutter: 6.0.3+2
fluttertoast: ^3.1.3
bubble: ^1.1.9+1
percent_indicator: ^2.1.1+1
smooth_star_rating: ^1.0.4+2
camera: ^0.5.2+1
koukicons: ^2.0.2
flutter_counter: ^1.0.3
font_awesome_flutter: ^8.7.0
devicelocale: ^0.2.1
horizontal_calendar: ^0.0.4
step_progress_indicator: ^0.2.1+4
flutter_plugin_tts: ^1.0.2
flutter_swiper: ^1.1.6
flutter_tts: ^1.1.0
flutter_youtube: ^2.0.0
device_info: ^0.4.2+4
I am using these pubspec.yaml libraries on my macOS and this file works without errors, but the same file fails on my Windows computer. I tried to remove the assets_audio_player folder and when I remove this folder I get the same error but the only difference is flutter_email_sender lib instead of assets_audio_player.
Solution 1:[1]
The cause of this issue was because of the Android build in the Flutter project seems to be yet to migrated to AndroidX. You can follow this guide to migrate the existing app to use AndroidX.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Omatt |
