skip to Main Content

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.
Try flutter 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


  1. Chosen as BEST ANSWER

    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!!!


  2. Changing the compileSdkVersion solved my problem.

    I changed compileSdkVersion in android/app/build.gradle

    From

     compileSdkVersion flutter.compileSdkVersion
    

    TO

    compileSdkVersion 33
    

    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 21

    Change From

    minSdkVersion 21
    

    To

    minSdkVersion 24
    

    Thanks to Johnyp

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search