I update the gradle plugin to the latest : com.android.tools.build:gradle:3.0.0-alpha1
and this error occured :
export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew test;else gradle test;fi
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'Android-app'. Could not
resolve all dependencies for configuration ':classpath'. Could not
find com.android.tools.build:gradle:3.0.0-alpha1. Searched in the
following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
Required by:
Current circle.yml
dependencies:
pre:
- mkdir -p $ANDROID_HOME"/licenses"
- echo $ANDROID_SDK_LICENSE > $ANDROID_HOME"/licenses/android-sdk-license"
- source environmentSetup.sh && get_android_sdk_25
cache_directories:
- /usr/local/android-sdk-linux
- ~/.android
- ~/.gradle
override:
- ./gradlew dependencies || true
test:
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
machine:
java:
version: oraclejdk8
Edit: My gradle file :
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'com.google.gms:google-services:3.0.0'
classpath "io.realm:realm-gradle-plugin:3.1.3"
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This question is related to
android
android-studio
gradle
build
circleci
For Iranian people: We need use proxy or VPN to building app.
Reason: The boycott by Google's servers causes that you can't build app or upgrade your requirement.
My problem was that I forgot that I added a proxy in gradle.properties
in C:\Users\(current user)\.gradle
like:
systemProp.http.proxyHost=****
systemProp.http.proxyPort=8850
Update: Incredibly frustrating, but the Google redirect of the maven.google.com
repo seems to mess with loading the resources. If you instead set your repository to
maven { url 'https://dl.google.com/dl/android/maven2' }
the files will resolve. You can prove this out by attempting to get the fully qualified resource at https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
3.0.0 Alpha
This is because currently the gradle:3.0.0-alpha1
is only being served via the new 'https://maven.google.com'
repository, but the site currently 404s at that location otherwise, being a public directory, you'd see a tree listing of all the files available by simply navigating to that location in your browser. When they resolve their outage, your CI build should pass immediately.
For things to compile via command line I needed to include the maven repo in BOTH buildscript
and allprojects
.
root build.gradle
:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
...
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
It's needed in the buildscript
block to find the AGP, and in allprojects
block to find android.arch
and com.android.databinding
packages (and others)
UPDATE:
It looks like the new repo is just called google()
but I still needed to declare it in both places.
Make sure you add following line in your top level build.gradle and that should fix it.
maven { url 'https://maven.google.com' }
I got exact same error you mentioned above, once I added this entry everything worked.
Android Studio (Preview) sometimes recommends updating to a Gradle Plugin that is not available yet (did Google forget to publish it?). Such as today with
'com.android.tools.build:gradle:3.1.0-beta1'
I found I can see current versions of com.android.tools.build:gradle here, and then I just pick the newest:
https://dl.google.com/dl/android/maven2/index.html
I just found this beta1 gradle bug in the Android Bug Tracker. I also just learned Android Studio > Help Menu > Submit Feedback brought me to the bug tracker.
Found temporary solution at androiddev reddit for the 3.1.0-beta1 problem: Either roll back to Preview Canary 8, or switch to gradle plugin 3.0.1 until Canary 10 is released shortly.
I find this at google: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
It mentiones that we need to
gradle-wrapper.properties
by distributionUrl=\https\://services.gradle.org/distributions/gradle-4.1-all.zip
repositories { google() }
and dependencies { classpath 'com.android.tools.build:gradle:3.0.0-beta7' }
You may require to have Android Studio 3
I did this:
click SDk Manager:
Change in updates to Canary Channel, check and update it...
After go in build.gradle and change the compile version to 26.0.0-beta2:
After go in gradle/build.gradle and change dependencies classpath 'com.android.tools.build:gradle:3.0.0-alpha7':
After sync the project... It works to me! I hope I've helped... tks!
mtrakal's solution worked fine.
Added to gradle.build:
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here;
// they belong in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Then it automatically upgraded to alpha2.
Invalidate the caches and restarted all is fine.
File | Invalidate Caches / Restart
choose 'Invalidate & Restart'
For me I solved this error just by adding this line inside repository
maven { url 'https://maven.google.com' }
To synchronize all of the answers here and elsewhere:
buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' } }
Make your buildscript in build.gradle look like this. It finds all of them between google and jcenter. Only one of them will not find all of the dependencies as of this answer.
Just add this
buildscript {
repositories {
...
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
It works...Cheers!!!
Source: Stackoverflow.com