0

I installed flutter when I create new Project this Error Appears

I Tried to uninstall and reinstall Android build sdk-tools 30.0.3 but the same problem.

the problem is

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Installed Build Tools revision 30.0.3 is corrupted. Remove and install again using the SDK Manager.

this is the project app/build.gradle:

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 31
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.untitled"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion 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 '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

and this is android/build.gradle:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I also Tried to try suggestion from the internet and edit build.gradle file but it still the same problem

I Hope somebody can help me..

saad tabban
  • 285
  • 3
  • 12
  • What is the error ? – Md. Kamrul Amin Nov 23 '22 at 10:41
  • @Md.KamrulAmin Thanks I Edit the Question Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. Installed Build Tools revision 30.0.3 is corrupted. Remove and install again using the SDK Manager. – saad tabban Nov 23 '22 at 12:37
  • what flutter doctor say? – Ahmad Raza Nov 23 '22 at 12:54
  • Try if the solution proposed in [this](https://stackoverflow.com/questions/34421193/could-not-determine-the-dependencies-of-task-appcrashlyticsstoredeobsdebug-i) post work for.. if not please share your flutter doctor output – xaer Nov 23 '22 at 14:11
  • flutter doctor says: X Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. – saad tabban Nov 23 '22 at 18:34
  • when i Run flutter doctor --android-licenses this is the output: java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) Could not find the main class: com.android.sdklib.tool.sdkmanager.SdkManagerCli. Program will exit. Exception in thread "main" – saad tabban Nov 23 '22 at 18:35
  • check this answer if this fixes your android licenses issue: https://stackoverflow.com/questions/61993738/flutter-doctor-android-licenses-gives-a-java-error – Md. Kamrul Amin Nov 24 '22 at 05:15

0 Answers0