Just after learning flutter, I encountered the following problems in the environment. * Error running Gradle: doesn't know how to find it!

as soon as a demo compiler is built and a demo console is run, the following occurs

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/rabbit/develop/android/flutter_app/android/gradlew" exited abnormally:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file "/Users/rabbit/develop/android/flutter_app/android/app/build.gradle" line: 25

* What went wrong:
A problem occurred evaluating project ":app".
> Could not resolve all files for configuration "classpath".
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

* 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 0s
  Command: /Users/rabbit/develop/android/flutter_app/android/gradlew app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

I found it on the Internet and didn"t come across the right answer to solve it. I saw the prompt that I couldn"t find com.android.tools.lint:lint-gradle-api:26.1.2 but opened it according to the prompt address and couldn"t download it. Where should I put it if I could download it?

resolved:

1:build.gradle,jcenter()google()jcenter google

buildscript {
    repositories {
        //google()
        //jcenter()
        maven { url "https://maven.aliyun.com/repository/google" }
        maven { url "https://maven.aliyun.com/repository/jcenter" }
        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:3.1.2"
    }
}

allprojects {
    repositories {
        //google()
        //jcenter()
        maven { url "https://maven.aliyun.com/repository/google" }
        maven { url "https://maven.aliyun.com/repository/jcenter" }
        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
    }
}


:fluttersdk 

Macintosh HD    rabbit    Flutter  packages  flutter_tools  gradle
 flutter.gradle  jcenter

buildscript {
    repositories {
        //jcenter()
        //maven {
        //    url "https://dl.google.com/dl/android/maven2"
        //}
        maven{
            url "https://maven.aliyun.com/repository/jcenter"
        }
        maven{
            url "http://maven.aliyun.com/nexus/content/groups/public"
        }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.1.2"
    }
}
Nov.03,2021

solution 1: modify build.gradle, and comment out jcenter (), google (). Use Ali's mirror image. The reason is a problem caused by the inability to access the jcenter google library. Although I have omnipotent wall-climbing tools, opening the global agent is still off the wall by our great Development and Reform Commission!

buildscript {

repositories {
    //google()
    //jcenter()
    maven { url 'https://maven.aliyun.com/repository/google' }
    maven { url 'https://maven.aliyun.com/repository/jcenter' }
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
}

}

allprojects {

repositories {
    //google()
    //jcenter()
    maven { url 'https://maven.aliyun.com/repository/google' }
    maven { url 'https://maven.aliyun.com/repository/jcenter' }
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}

}

step 2: find the fluttersdk directory and enter the following directory

Macintosh HD users users rabbit repositories Flutter packages packages flutter_tools gradle
find the following flutter.gradle file and replace it with jcenter as I did.

buildscript {

repositories {
    //jcenter()
    //maven {
    //    url 'https://dl.google.com/dl/android/maven2'
    //}
    maven{
        url 'https://maven.aliyun.com/repository/jcenter'
    }
    maven{
        url 'http://maven.aliyun.com/nexus/content/groups/public'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
}

}
at this point, run again and solve the problem.


an item is missing upstairs, and flutter.gradle needs to add this code:

maven{
    url 'https://maven.aliyun.com/repository/google'
}

try to introduce google () under the build.gradle file of each project

allprojects {
    repositories {
        // google() 
        google()
        jcenter()
    }
}

has the landlord solved it? I have also encountered this problem, and I have not found a solution. It is estimated that it is the android studio version and the gradle version


I have changed the build.gradle and flutter.gradle files, and click to run
Initializing gradle. all the time.
timeout waiting for the application to start
what to do.


climb over the wall and solve all the pain points


before I climbed over the wall on the PC side and various configurations, but it still didn't work. Later, I used pc to connect the hotspots of my phone and climbed the wall on pc. I felt that there was still a problem with the network. The PC network is different from the mobile network. You can try ok, on the mobile end


.

still report an error after correction

    Where:
    Build file    
    'C:\Users\Administrator\Desktop\SaltedFishApp\salted_fish\android\app\build.gradle' line: 25
    What went wrong:
    A problem occurred evaluating project ':app'.
    Could not resolve all artifacts for configuration 'classpath'.
    Could not find com.android.tools.build:gradle:3.2.1.
    Searched in the following locations:
   - https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
   - https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
   - http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
   - http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
 Required by:
 unspecified:unspecified:unspecified

what's wrong with that?

Menu