0

I wanted to test my flutter app in phone. I tried to build an apk by Android Studio. But i toke error.

I said, I click Build > Flutter > Build APK

Results:

C:\SRC\flutter\bin\flutter.bat --no-color build apk

 Building with sound null safety 

Running Gradle task 'assembleRelease'...                        

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:7.6.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.6/gradle-7.6.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.6/gradle-7.6.pom
     Required by:
         project :

* 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

BU�LD FAILED in 11s
Running Gradle task 'assembleRelease'...                           12,6s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1

My build.gradle:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.6'
        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
}

My gradle.properties:

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

My gradle-wrapper.properties:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip

I have 7.6 gradle files.

gradle files

I have Java 19 and 17

java files

That is solved my error: Could not find com.android.tools.build:gradle:7.3.3. error found in build.gradle file

CanKURT
  • 23
  • 4

0 Answers0