I keep getting this error. Any ideas?
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:classpath'.
Could not find com.android.tools.build:gradle:2.0.0-beta7.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-beta7/gradle-2.0.0-beta7.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-beta7/gradle-2.0.0-beta7.jar
You are referring maven central for finding android plugin artifacts, android gradle plugin is published at jcenter
add jcenter() to buildscript.repositories block in your root build.gradle file.
It should look like as below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:X.X.X' // your verison
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Related
I just created a new android project to test something separate to my main one, and this happened. I tried it several times and get the same error every time.
A problem occurred configuring root project 'login_test'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
try to change version of kotlin in build.gradle under the root directory.I use 1.3.72 here
buildscript {
ext.kotlin_version = '1.0.0'
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I got this error in Gradle Console
Error:A problem occurred configuring root project 'QuakeReport'.
Could not resolve all files for configuration ':classpath'.
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 41s
I got this error in messages
Error:A problem occurred configuring root project 'QuakeReport'.
Could not resolve all files for configuration ':classpath'.
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :
try adding this to your project level build.gradle.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Android artifacts are no longer posted to bintray. Use google's repository to your build script.
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
See here: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin
I'm creating a news downloading gradle project with the following directory structure.
news-feed (root)
|-bbc-plugin (sub-project)
I want to use the jsoup library for my sub-projects so I add the dependency to my root build.gradle file as follows.
import org.gradle.api.artifacts.*
apply plugin: 'base' // To add "clean" task to the root project.
apply plugin: 'application'
mainClassName = 'newsFeed.MainMenu'
subprojects {
apply from: rootProject.file('common.gradle')
apply plugin: 'java'
dependencies {
compile 'org.jsoup:jsoup:1.10.3'
}
}
dependencies {
compile project(':bbc-plugin')
}
I can't build the project because of the error
* What went wrong:
Could not resolve all files for configuration ':bbc-plugin:compileClasspath'.
> Can't resolve external dependency org.jsoup:jsoup:1.10.3 because no repositories are defined.
Required by:
project :bbc-plugin
Is there are way to specify the dependency in the root build file without having to specify in the build.gradle file of each sub-project?
You need to tell gradle from which repository it can download your dependency. To achieve this, you need to add a repositories section to your build script.
To use Maven Central, for instance, you need to add the following lines to your to root build.gradle:
repositories {
mavenCentral()
}
See here and here in the Gradle user guide for a more detailed description.
When I am importing the project, I am getting the following error:
Error:A problem occurred configuring root project 'BoomMenu-master'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4.
Required by: :BoomMenu-master:unspecified
> No cached version of com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4 available for offline mode.
> Could not resolve com.github.dcendents:android-maven-gradle-plugin:1.3. Required by:
:BoomMenu-master:unspecified
> No cached version of com.github.dcendents:android-maven-gradle-plugin:1.3 available for
offline mode.
There are some solution which i had applied previously that ,
1 . Try to rebuild your project for 2 to 3 times.
2 . Open your build.gradle file and then add line at top that these lines ,here you must choose build gradle version according to your sdk .
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
3. Open your library build.gradle file say in yours you must open boommenu file .
add these lines at top ,
apply plugin: 'com.android.application'
4.Try to changed proxyPort to 8080 and used jcenter instead of Maven. But i had to apply expeption to use HTTP instead of HTTPS. This is what i have in my gradle.build for build script and allprojects
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
I've already solved this but i'm still curious as to why gradle behaves this way.
In my gradle project i have 2 gradle projects, one named app that is configured with the ear plugin and one named core that is deployed in the lib folder of the ear
I was getting the following error when trying to build my gradle project:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':app:earlib'.
> Could not find org.slf4j:slf4j-api:1.7.5.
Required by:
saturn:app:unspecified > saturn:core:unspecified
> Could not find commons-io:commons-io:2.4.
Required by:
saturn:app:unspecified > saturn:core:unspecified
> Could not find org.slf4j:slf4j-log4j12:1.7.5.
Required by:
saturn:app:unspecified > saturn:core:unspecified
> Could not find log4j:log4j:1.2.17.
Required by:
saturn:app:unspecified > saturn:core:unspecified
My app build.gradle file is:
apply plugin: 'ear'
dependencies {
earlib project(":core")
}
and my core build.gradle is:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
runtime 'org.slf4j:slf4j-log4j12:1.7.5'
runtime 'log4j:log4j:1.2.17'
testCompile 'junit:junit:4.11'
}
Temporary Solution:
I was able to resolve the issue by adding the mavenCentral repository to my app build.gradle like so:
apply plugin: 'ear'
repositories {
mavenCentral()
}
dependencies {
earlib project(':core')
}
HOWEVER I'm still curious as to why the depending project needs to know what repository the core project resolves it's dependencies from. this document on dependency management doesn't seem to have a very good explanation.
When resolving a configuration, Gradle (only) uses the repositories declared in the same project as the configuration. Hence when resolving the ear project's earlib configuration, only the ear project's repositories are taken into account. That's one reason why it's common to declare all repositories under subprojects in the root build script.