flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.29k stars 27.52k forks source link

Could not resolve all artifacts for configuration 'classpath' #23553

Closed SuperCup closed 6 years ago

SuperCup commented 6 years ago

From URL: https://www.flutterchina.club/support.md

Finished with error: Please review your Gradle project setup in the android/ folder.
* Error running Gradle:
ProcessException: Process "/Users/../Desktop/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/../Desktop/flutter_app/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 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/../Desktop/flutter_app/android/gradlew app:properties`

I have already done:

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}
jsakars commented 6 years ago

Same here. This is fixed in master but not under stable release yet. For now, I would suggest switching to master branch and wait for the fix to be released.

https://github.com/flutter/flutter/issues/23095

Here is the commit - https://github.com/flutter/flutter/commit/125b5d623c305b0b7e11ec6bef80f863f9e9cb1a

zoechi commented 6 years ago

Merging with #23404

sumation commented 6 years ago

same issue

Parth1029 commented 6 years ago

I solved the problem by moving :

maven {
    url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle :

    buildscript {
    repositories {
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}
sumation commented 6 years ago

same issue Solved by adding "google()" to gradle

songyiYu commented 6 years ago

@Parth1029 It is solved! Thank you 👍

Sly777 commented 6 years ago

@Parth1029 thanks it works on my app as well!

rravithejareddy commented 6 years ago

still i am facing the issue.

xring commented 6 years ago

@ Parth1029 Great work! Thx.

rravithejareddy commented 6 years ago

@Parth1029 still i am facing the issue, i tried to adding google(), but still i am getting same issue.

marianoarga commented 6 years ago

Upgrading Flutter should fix it @rravithejareddy

rravithejareddy commented 6 years ago

Fixed by adding google() in flutter.gradle. Thanks.

yefeidd commented 5 years ago

I solved the problem. File->setting->build->Gradle->Android studio checked "Enable embedded Maven repository".

ethanyou725 commented 5 years ago
gradle.properties set proxy 
org.gradle.jvmargs=-Xmx1536M
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=yourport
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=yourport
TakeEasyBoy commented 5 years ago

I solved the problem.In android folder,edit build.gradle file like this:

buildscript {
    repositories {
        google()
        mavenCentral()  //add this line
        jcenter()
    }

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

It works. stackoverflow link

alitavanaali commented 5 years ago

I had the same problem :

Could not resolve all artifacts for configuration ':classpath'. Could not find builder.jar (com.android.tools.build:builder:3.0.1) ...... (62 error line)

The problem occurred when I was trying to add a package to my pubspec.yaml (audioplayers) so if you have the same problem, in Android Studio, at the left side (Project View (alt +1) navigate to: External Libraries > Flutter Plugins > audioplayer (you should go to your plugin) > android > build.gradle and change classpath 'com.android.tools.build:gradle:OLD VERSION' to YOUR VERSION. For example that was 3.0.1 which I needed 3.3.0

prabh08 commented 5 years ago

I have made all the possible changes but still I am facing this issue. Please help me. Here is I am getting while performing tns run

A problem occurred configuring root project 'newAppo'.

Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.4.1. Required by: project : Could not resolve com.android.tools.build:gradle:3.4.1. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty Could not resolve com.android.tools.build:gradle:3.4.1. Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty Could not resolve com.android.tools.build:gradle:3.4.1. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'. java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Benklins commented 5 years ago

pls same issue.

error message below: FAILURE: Build failed with an exception.

jonathar2605 commented 5 years ago

Hi, I have this problem when I try to execute a Serenity BDD project, I need to run from command line a gradle execution but generate that problem.

$ gradle clean test aggregate

FAILURE: Build failed with an exception.

BUILD FAILED in 6m 31s Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\Micro Focus\Unified Functional Testing\bin\java_shared\classes\jasmine.jar"

And this is my build.gradle

buildscript { repositories { mavenLocal() jcenter()
mavenCentral() maven {url = 'http://repo.maven.apache.org/maven2'} }

dependencies {
    classpath "net.serenity-bdd:serenity-gradle-plugin:2.0.49"
    classpath "net.serenity-bdd:serenity-emailer:2.0.49"

}   

}

plugins { // Apply the java-library plugin to add support for Java Library id 'java-library' }

repositories { // Use jcenter for resolving your dependencies. // You can declare any Maven/Ivy/file repository here. mavenLocal() jcenter() }

apply plugin: 'net.serenity-bdd.aggregator' apply plugin: 'java' apply plugin: 'eclipse'

defaultTasks = ['clean', 'build']

tasks.withType(Test) { reports.html.destination = new File('IVR', name) println(it.name + '\t' + reports.html.destination) scanForTestClasses = false include "*/Runner.class" // whatever Ant pattern matches your test class files }

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath. api 'org.apache.commons:commons-math3:3.6.1'

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:26.0-jre'

// Use JUnit test framework
testImplementation 'junit:junit:4.12'    

compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '4.1.0'    
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.0'
compile group: 'org.apache.poi', name: 'poi', version: '4.1.0'
compile group: 'net.serenity-bdd', name: 'serenity-reports', version: '2.0.49'
compile group: 'net.serenity-bdd', name: 'serenity-model', version: '2.0.49'
compile group: 'net.serenity-bdd', name: 'serenity-junit', version: '2.0.49'
compile group: 'net.serenity-bdd', name: 'serenity-core', version: '2.0.49'
compile group: 'net.serenity-bdd', name: 'serenity-cucumber', version: '1.9.31'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta4'    
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.8.0-beta4'

compile group: 'net.serenity-bdd', name: 'serenity-gradle-plugin', version: '1.9.36'
compile group: 'net.serenity-bdd', name: 'serenity-emailer', version: '1.9.36'

}

serenity { reports = ["email"] }

test.finalizedBy(aggregate)

Please help me, with this problem

Paulswith commented 5 years ago

I run it on vs code and throws the same problem. like below:

* Get more help at https://help.gradle.org

BUILD FAILED in 30s
  Command: /Users/dobby/Dropbox/Code/Android/VSFlutter/hello_flutter/android/gradlew app:properties

Open terminal goes to /path/to/your/app/android, run above command with proxy configs, and it resolved.

./gradlew app:properties -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=1087 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=1087 --debug

image

irvingreece commented 5 years ago

TakeEasyBoy's suggestion worked for me. Thanks.

PocoMin commented 5 years ago

Go to cordova-support-google-services/app-build.gradle, replace maventCentral() with maven { url "https://maven.google.com" } maven { url 'https://dl.bintray.com/kotlin/kotlin-eap'} Credits to hunijkah in https://stackoverflow.com/questions/58529904/error-could-not-find-org-jetbrains-kotlinkotlin-stdlib-jdk81-3-60-eap-25-in-i

gayanramyakumara commented 5 years ago

Got the same issue.anyone can help me..please.

Screen Shot 2019-10-26 at 11 56 15 PM

Suppppppp commented 5 years ago

I did everything that written this page but it doesn't work. Last, I tried to update so it worked. If you tried all the way but when it doesn't work, try update flutter

yibingxiong commented 5 years ago

@TakeEasyBoy not work. I'm dying

yibingxiong commented 5 years ago

@Parth1029 not work. I'm dying really.

yibingxiong commented 5 years ago

@Suppppppp I updated flutter 1.9.1+hotfix.6 , but it doesn't work also. what your flutter version.

Flutter 1.9.1+hotfix.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 68587a0916 (7 weeks ago) • 2019-09-13 19:46:58 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
aboutmydreams commented 5 years ago

not work. I'm dying really too

flutteradv commented 4 years ago

I faced this error after upgrading to Flutter 1.12.13+hotfix.5 :

Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not download flutter_embedding_debug.jar (io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695)
      > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.jar'.
onemanstartup commented 4 years ago

@flutteradv Update flutter, Accept android licences flutter doctor --android-licenses, run flutter clean

flutteradv commented 4 years ago

I ended up reverting back to flutter 1.9.1

shaileshpanthee commented 4 years ago

I solved the problem by moving :

maven {
    url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle :

    buildscript {
    repositories {
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

I couldn't find the file .flutter. Where is the .flutter dir located?

coderoid-omega commented 4 years ago

I solved the problem.In android folder,edit build.gradle file like this:

buildscript {
    repositories {
        google()
        mavenCentral()  //add this line
        jcenter()
    }

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

It works. stackoverflow link

It Worked!

coderoid-omega commented 4 years ago

I solved the problem by moving :

maven {
    url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle :

    buildscript {
    repositories {
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

I couldn't find the file .flutter. Where is the .flutter dir located?

.flutter is just a convention, here '.flutter' is the path where you extracted or installed flutter in your system. Hope this helps you.

Niek-Okido commented 4 years ago

edit the following in build.gradle :

    repositories {
        jcenter()
        mavenCentral() #add
        google() #add
    }
    ....
}
succygoldbaji commented 4 years ago

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.

i Dont know why am getting this error......

THIS IS MY build.gradle pls i dont know what to do

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()

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

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { google() jcenter()

}

}

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

derekgithubs commented 4 years ago

I solved it by....

It worked for me, i'm using Windows...

nhhockeyplayer commented 4 years ago

this is outrageous the whole subsystem, surrounding gradle needs to be torn out honked and redesigned and replaced I have never seen such lengthy issues on incomplete gradle mechanisms and they still havent gotten it right i spent days/weeks June 2019 on same gradle wrapper transient dependencies omissions and now its impact8in my development schedule again

WHEN WILL THEY FINALLY DESIGN SOMETHING THATS CONFIGURABLE FROM THE ROOT FILE CONFIG.XML AND BE DONE WITH IT... environment variables anyone ?

I know if Im going to shoot my mouth off I should do it myself

well its simple

a root environment variable that trickles down thru the whole archetype

DONE

and maybe a flag for caching to prevent tangled repo jars

Sylvester-dev commented 4 years ago

@gayanramyakumara I am also facing same issue can i know how you solved this issue.

nhhockeyplayer commented 4 years ago

i went with capacitor instead of treating the android like a build artifact it treats it as a source artifact completely configurable

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.