I’m using Visual Studio code to run Flutter program that use "just_audio
" to use audio files from local assets.
When running "flutter pub add just_audio
" I have errors on dependencies and have this error:
"just_audio" is already in "dependencies". Will try to update the constraint.
Resolving dependencies…
leak_tracker 10.0.0 (10.0.4 available)
leak_tracker_flutter_testing 2.0.1 (3.0.3 available)
leak_tracker_testing 2.0.1 (3.0.1 available)
meta 1.11.0 (1.12.0 available)
test_api 0.6.1 (0.7.0 available)
vm_service 13.0.0 (14.0.0 available)
Got dependencies!
6 packages have newer versions incompatible with dependency constraints.
Tryflutter pub outdated
for more information.
When running the program I have the following in debug Console:
Multidex support is required for your android app to build since the number of methods has exceeded 64k. See https://docs.flutter.dev/deployment/android#enabling-multidex-support for more information. You may pass the –no-multidex flag to skip Flutter’s multidex support to use a manual solution.
Flutter tool can add multidex support. The following file will be added by Flutter:
android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java
cannot prompt without a terminal ui
Error: Gradle task assembleDebug failed with exit code 1
I have tried other packages other than "just_audio
" and seems that same problem I’m stuck in.
Extensions versions used in Visual Studio Code:
- Dart: v3.83.20240220
- Flutter: v3.82.0
I don’t have so much experience in Flutter and I am in the entry level. Appreciate your support.
2
Answers
I can finally solve the problem. I have tried another package "audioplayers" and have also errors. Then I have updated Visual Studio Code, and this lead to a storage error. Then I have changed the storage of the virtual device, and it works!!!
Changing the compileSdkVersion solved my problem.
I changed
compileSdkVersion
in android/app/build.gradleFrom
TO
and the error gone.
EDIT:
I got the same issue when i change the compile sdk to 34 which flutter recommended me because i was using url_launcher and video_player which use compileSdk 34. and as i changed the compileSdkVersion to 34 i got the same issue again and that i solved by changing the
minSdkVersion
to 24 from 21Change From
To
Thanks to Johnyp