skip to Main Content

It was working better pervious but when i update Android Studio to Ladybug it all started. my java versions and everything changed and the worst part is i didn’t remember my old setting. So, below it the problem.
When i try to debug or build apk the flutter project show this error:

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

* 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

This is with many such library like: url_launcher,share_pluse,shared_preferences and path_provider.
Below is fluter doctor

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22621.3880], locale en-US)
    • Flutter version 3.24.3 on channel stable at D:Installedflutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at D:AndroidSdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: D:InstalledAndroidStudiojbrbinjava
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:Program FilesGoogleChromeApplicationchrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.8.2)
    • Visual Studio at C:Program Files (x86)Microsoft Visual Studio2022BuildTools
    • Visual Studio Build Tools 2022 version 17.8.34322.80
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2)
    • Android Studio at D:InstalledAndroidStudio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3880]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 129.0.6668.101
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 126.0.2592.68

[√] Network resources
    • All expected network resources are available.

• No issues found!

gradle.properties

org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-7.4-all.zip

setting.gradle

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.1" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

include ":app"

app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader("UTF-8") { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
    flutterVersionCode = "2"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
    flutterVersionName = "1.0"
}

android {
    namespace = "com.example.xxxx"
    compileSdk = 35
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "com.example.xxxxx"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutterVersionCode.toInteger()
        versionName = flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.debug
        }
    }
}

flutter {
    source = "../.."
}


It all happened because of share_plus. Before everything working fine but share_pluse required java 17 to work on.

Help me to fix it.

i already tried many gradle version but nothing works for me. I also change the android studio runtime version to 17.0.12… but no work.

Please help me to fix it… plz..

2

Answers


  1. Chosen as BEST ANSWER

    Finally the issue was fixed. I just uninstall the Ladybug version and downgraded to Giraffe (September 2023) version and everything works fine. If you have same problem downgrade your Android Studio.


  2. Had the same issue.

    So first download jdk17 from respective website. then use this command in terminal of your project

    flutter config –jdk-dir /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home

    from "/Library" to "/Home" is your desired jdk location.

    This is another fix that worked for me https://stackoverflow.com/a/73985328/8764293

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