Dinesh
Dinesh

Reputation: 21

"compileDebugJavaWithJavac" Gradle task assembleDebug failed

I'm trying to build my Flutter project after changing

Android Studio Ladybug | 2024.2.1 Patch 3

Flutter version 3.24.5

Dart version 3.5.4

DevTools version 2.37.3

Android SDK version 34.0.0

Platform android-34,

build-tools 34.0.0

gradle-wrapper.properties: distributionUrl=https://services.gradle.org/distributions/gradle-8.3-all.zip

After the update:

create new flutter project without adding any packages in pubspec.yaml build successfully.

when I try to add

pubspec.yaml

url_launcher: ^6.3.1

shared_preferences: ^2.3.3,

I am facing this issues

Launching lib\main.dart on sdk gphone16k x86 64 in debug mode... Running Gradle task 'assembleDebug'...

Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-> line tools that were released at different times.

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task >':url_launcher_android:compileDebugJavaWithJavac'. Could not determine the dependencies of null. Cannot query the value of this provider because it has no value available.

BUILD FAILED in 31s Error: Gradle task assembleDebug failed with exit code 1

For reference git code:

https://github.com/rdinesh19/sample12.git

Upvotes: 1

Views: 86

Answers (1)

DevQt
DevQt

Reputation: 719

I hope you add packages using this command:

flutter pub add <package_name>

If so, try these as well:

Update your settings.gradle file:

plugins { id 'com.android.application' version '8.7.0' apply false id 'com.android.library' version '8.7.0' apply false id 'org.jetbrains.kotlin.android' version '2.0.20' apply false }

Update your gradle/wrapper/gradle-wrapper.properties file:

distributionUrl = https\://services.gradle.org/distributions/gradle-8.7-bin.zip

Perform these commands in your terminal:

flutter pub get
flutter clean
flutter pub cache repair

Note: flutter pub cache repair is optional, but if you find it necessary, execute this as well.

Then rebuild your project again.

I hope it helps!

Upvotes: 0

Related Questions