For new android studio tool with following build script
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
I am getting following error.
A problem occurred evaluating root project 'android'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
unspecified:unspecified:unspecified
There website shows that we need to add google in buildscript, which is right there.
https://developer.android.com/studio/releases/gradle-plugin
Related
error:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.0.1.
Could not get resource 'https://jcenter.bintray.com/com/android/tools /build/gradle/3.0.1/gradle-3.0.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build /gradle/3.0.1/gradle-3.0.1.pom'.
jcenter.bintray.com
Could not resolve com.android.tools.build:gradle:3.0.1.
Could not get resource 'https://maven.google.com/com/android/tools/bu ild/gradle/3.0.1/gradle-3.0.1.pom'.
Could not GET 'https://maven.google.com/com/android/tools/build/gr adle/3.0.1/gradle-3.0.1.pom'.
dl.google.com
while i can download gradle-3.0.1.pom in my browser.
my env:
android studio 3.2.1
cordova 8.1.2
win 10
I tried to force gradle-wrapper.properties to use http for
distributionUrl=http\://services.gradle.org/distributions/gradle-4.1-all.zip
but no succuss.
I removed and reinstalled cordova,android studio and sdk build tools to latest versions and problem is still remain.
my build.gradle :
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="27.0.1" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
changing maven url to google() is not working.
enable embedded maven repository in android studio is not a solution.
Error message:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
A problem occurred configuring project ':CordovaLib'.
Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
Could not find com.android.tools.build:gradle:2.2.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar
Required by:
android:CordovaLib:unspecified
Remove platforms/android folder and add Android again:
ionic platform add android
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
add jcenter() to your repositories.
this worked for me.
A bit late but as the other answers didn't work hopefully this will help others
Update your Android CordovaLib to the latest version
https://cordova.apache.org/blog/
Find the latest version and run the command given
e.g. cordova platform update android#6.1.0
If this is not possible (or doesn't work) manually change the file
\platforms\android\CordovaLib\build.gradle and add in jcenter()
repositories {
mavenCentral()
jcenter()
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
try modifying these in your build.gradle . good luck
Gradle Issue in Android Studio 2.1.3
I got those errors when i run the Desktop application that i've created based on the Tutorial.
where i can find that Gradle 2.1.3? Please help me. Im using Libgdx framework. Thank you in advance.
Error:Gradle: A problem occurred configuring root project 'Flapp Bird'.
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.1.3.
Searched in the following locations:
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
Required by:
:Flapp Bird:unspecified
The Gradle version 2.1.3 exists, but is not in the Maven central, as said here.
To fix the issue, just add jcenter() after mavenCentral() in your build script.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
No, Ivan is right. The latest version of Android Studio insists on upgrading to Android Plugin for Gradle, Revision 2.1.3 (August 2016), Gradle 2.14.1 or higher and Build Tools 23.0.2 or higher.
But the moment it does that, it breaks compilation with that error:
Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:2.1.3. Searched in the following locations:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.3'
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
For me adding this: classpath 'com.android.tools.build:gradle-experimental:0.7.3' did the trick.
AFAIK, the latest version of Gradle is 2.1.2. You might be confusing the gradle version with the gradle plugin. A similar question to yours was also answered over here Just change 'com.android.tools.build:gradle:2.1.3' to 2.1.2and you should be set.
I am using Android studio 2.1.1 with gradle current version - 2.10.
I am trying to upgrade gradle version to 2.14.1, for which I have done the following:
In gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
In build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.12'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Upon syncing, I get the following error:
Error:Could not find com.android.tools.build:gradle:2.14.1.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar
Required by:
:MultiPanePlayer:unspecified
My project-level settings has the following option "Use default gradle wrapper (recommended)" selected. Am I missing anything else ?
Issue Error with gradle plugin not getting updated resolved - If you are getting this error you should update the plugin version to 2.1.2 as #Henry has mentioned or 2.3.1. (Be careful it is 2.1.2 and not not 2.12). Here is the sample project level build.gradle that resolved my error-
// 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:2.3.1'
}
}
allprojects {
repositories {
jcenter()
}
}
I'm setting up a Cordova project with Fabric to enable signing in with Twitter. I just installed Fabric plug-in into Android Studio but when I sync Gradle files I get the following error:
Information:Gradle tasks [:generateDebugSources, :generateDebugTestSources]
Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.squareup.picasso:picasso:2.3.2.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.pom
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.android.support:support-v4:21.0.0.
Searched in the following locations:
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.pom
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.squareup.retrofit:retrofit:1.6.1.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.pom
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
> Could not find com.google.code.gson:gson:2.2.4.
Searched in the following locations:
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
Android SDK updater gives me Support Library 21.0.3 but not 21.0.0, as suggested here by Hemal from Fabric: Android Twitter Fabric SDK conflict with support library
I have no idea about those other libraries, though. Any thoughts?
Please follow this code example to make sure your build.gradle file is similar:
buildscript {
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application' // <- *make sure this is the same
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
I had the same issue, spent half a day on this until opened twitters official documentation and came across this:
https://dev.twitter.com/twitter-kit/android/integrate
Too many answers by the Fabric team on SO and other forums that did not work. This works.
Change jcenter() to mavenCentral() or you can keep both jcenter and mavenCentral
also change url from https://maven.fabric.io/repo to https://maven.fabric.io/public
buildscript {
repositories {
mavenCentral() // <- *add this
maven { url 'https://maven.fabric.io/public' }
}
}
It's not enough to install the fabric plugin, you have to use it too. Clicking on the fabric button in Android Studio guides you through the process of including twitter fabric in your app, it even modifies the build.gradle properly for you (with your permission of course). When you follow the steps given, your build.gradle would be looking like what #AlexVPerl's answer says.
Other answers were outdated for me. I fixed the problem by updating build.gradle according to the latest on the github:
https://github.com/twitter/twitter-kit-android