skip to Main Content

github repo: https://github.com/MichaelR778/flutter-music-player-1

I got a new laptop so I cloned some project from my github, but it won’t run. I followed this to set up flutter: https://docs.flutter.dev/get-started/install/windows/mobile. I tested it by creating new project and it runs just fine but when I tried to run this project from my github repo I got error:

Launching libmain.dart on RMX3630 in debug mode…
ERROR:C:UsersmichaFlutter Projectsflutter-music-player-1buildpath_provider_androidintermediatesruntime_library_classes_jardebugclasses.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeLibDexDebug’.

Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
Failed to transform classes.jar (project :path_provider_android) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.3.0, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.gradle.internal.attributes.VariantAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:UsersmichaFlutter Projectsflutter-music-player-1buildpath_provider_androidintermediatesruntime_library_classes_jardebugclasses.jar.
> Error while dexing.

  • 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 5s
Error: Gradle task assembleDebug failed with exit code 1

I tried to install jdk 21 because my old laptop had it and was able to run the project but installing jdk 21 doesn’t help at all.

2

Answers


  1. This error could be occurred due to mismatch between gradle version and Android SDK version. I recommend to figure it out by opening just the "android" folder (not the whole Flutter project) with Android Studio. After opening, the Android Studio will automatically download and install the gradle.

    If there is any issue related to conflict between gradle version and Android Studio SDK version, you will get specific error message and recommendations in the build section. Then you can follow the recommendations to solve the conflict.

    If it builds the gradle successfully, your problem probably will be solved.

    Login or Signup to reply.
    • update the flutter-music-player dependency to the latest.
    • fix dependency issues if any when doing flutter pub get
    • check if you are not passing any null values to methods of the music player package 😉
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search