Could not find com.android.tools.build:gradle:4.0.0 - android

gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
gradle-wrapper
// 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:4.0.0"
// 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
}
Could not find com.android.tools.build:gradle:4.0.0.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.0/gradle-4.0.0.pom

I struggled in a similar question after upgrading the Android Gradle Plugin Version from 3.3.0 to 4.0.0 of a React Native project as suggested by Android Studio. I followed the answer but it still do not sync correctly.
Finally I run rm -rf node_modules and re-install all the dependencies by npm install. After that I sync again and it sync correctly. I guess that there are some caches in different node modules that are not cleaned properly. I hope if someone encounter similar problem can try and see if my answer fix the problem.

I faced this issue after Invalidating caches under File -> Invalidate Cache/Restart
Later deleted node_modules under project folder and then did an npm install.
On Click of File -> Sync Project with Gradle Files resolved this issue

Related

My gradle build failed after I imported volley library

I have implemented phone number detection and SMS verification functionality into my project by referring to this project
https://www.programcreek.com/java-api-examples/?code=android%2Fidentity-samples%2Fidentity-samples-master%2FSmsVerification%2Fapp%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fsamples%2Fsmartlock%2Fsms_verify%2Fui%2FPhoneNumberActivity.java#
I downloaded and imported volley from the link below
https://github.com/google/volley
I am getting an error while building my project, please guide me I am new to android studio...
Error
Unable to find method 'org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
build.gradle
// 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:4.0.1"
classpath 'com.google.gms:google-services:4.2.0'
// 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
}
Update:
I deleted gradle file from C:\Users\MY PC.gradle\wrapper\dists and rebuilt the project and now I am getting this error
Error Unknown host 'services.gradle.org'. You may need to adjust the
proxy settings in Gradle. Enable Gradle 'offline mode' and sync
project Learn about configuring HTTP proxies in Gradle
change the distributionUrl in the gradle-wrapper.properties to distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip to get the build running again. This seems to be a similar problem Gradle sync failed: Unable to find method.

Could not find com.android.tools.build:gradle:5.4.1

I just turned on an old computer and am trying to access some code. After updating all of my Android Studio, JDK, and Downloading the latest Gradle I am having trouble building the project. I get this error ;
ERROR: Could not find com.android.tools.build:gradle:5.4.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I have dont this and this
Below is the content of build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:5.4.1'
}
}
Below is the content of wrapper file
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
in my settings I have toggled between default and setting my path manually. I have also attemted to add google() and MavenCentral() to the repositories
I just ant to build and run my app but it is saying no! haha help
Don't confuse gradle with the Android Gradle plugin.
classpath 'com.android.tools.build:gradle:5.4.1'
It is the Android Gradle plugin and 5.4.1 doesn't exist.
Use the latest stable release:
classpath 'com.android.tools.build:gradle:3.4.1'
Check the release notes for other versions.
If you open URL https://jcenter.bintray.com/com/android/tools/build/gradle, there is no 5.4.1.
For gradle version meanings, please check What is real Android Studio Gradle Version?.
For your case, you need to add google() repo in your buildscript closure and modify the android-gradle-plugin version to be 3.4.1
buildscript {
repositories {
google()// <-- add this.
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
And, also, probably, you need to update your allprojects closure as below:
allprojects {
repositories {
google()// <-- add this.
jcenter()
}
}
Edit #1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
This is the wrapper configuration telling which gradle version to use for your android gradle plugin. It is NOT the plugin version.

Android Gradle 4.1-rc-1 Not Found

In Android Studio 3.0 Beta 1, I'm required to use Gradle 4.1-rc-1. AS offered to do the update for me (why not) but when the project tries to build, I get an error saying the pom and jar for gradle-4.1-rc-1. It's apparently not in the jcenter or google repos. On Google's AS release page, they mention this is a known bug and that a clean and sync should fix it, but it did not work for me.
Here is my build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1-rc-1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Which repository holds the correct gradle files? Should they have downloaded to my machine already?
Maybe you should update your gradle/wrapper/gradle-wrapper.properties file of your project, instead of build.gradle.
Here is my content of gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip. Content of build.gradle : classpath 'com.android.tools.build:gradle:3.0.0-beta1'.
I got it working although I'm not exactly sure what did it. However, here are some things I did and some extra information if anyone else is running into this issue as well.
Project Settings (⌘;)
Gradle Version: 4.1
Android Plugin Version: 3.0.0-beta1
Android Plugin Repository: google(), jcenter
Default Library Repository: google(), jcenter, 'https://jitpack.io'
With these settings, upon trying to sync, I would be asked to update my Gradle to 4.1-rc-1. I pressed the "do it manually" option. Then I went to my project in the terminal and did what google suggested:
gradlew clean
gradlew assemble

Android studio 2.3 refreshing continuously

I've recently updated android studio to 2.3...After update it is continuously refreshing the project.So I clicked on invalidate cache and restart..After that it is showing this error
This is the error image
This is my build.gradle file
// 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.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my gradle-wrapper.properties file
#Mon Mar 13 16:42:48 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
This is my gradle location
C:/Program Files/Android/Android Studio/gradle/gradle-3.2
Everything seems to be good to me.I dont know what should I change...Please help me
Click on the blue link - Upgrade Gradle Wrapper - that should fix it
For those who face similar problem here is the solution.Download gradle files manually from internet which is of around 80 mb and replace these new files with those of old ones in android stuido.

Android Studio cannot find com.android.tools.build:grade:2.10

Having resolved an error thanks to tihs 'Gradle Version 2.10 is required' post. I'm not getting a new error.
I've been trying to follow answers like this one but nothing I try seems to work. I wonder if this is because I'm on a later version of gradle and Android Studio. I'm still getting this error in Android Studio
Error:Could not find com.android.tools.build:gradle:2.10.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.10/gradle-2.10.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.10/gradle-2.10.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.10/gradle-2.10.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.10/gradle-2.10.jar
Required by:
:android:unspecified
I've updated my build.gradle file to include:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
}
And gradle-wrapper.properties to
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-all.zip
I'm at a loss of what to try next. This is app build on the Ionic framework (using cordova). the ionic build android command results in the same error too.
I'm using a Mac and Android Studio 2.1
Change
classpath 'com.android.tools.build:gradle:2.10'
to
classpath 'com.android.tools.build:gradle:2.1.0'
there is no version : 2.10 in gradle for Android Studio change it to:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
new answer :
please try to update gradle-wrapper.properties :
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
then in project build.gradle use this version:
classpath 'com.android.tools.build:gradle:1.5.0'
From menu: choose File -> Invalidate Caches/Restart... >> Invalidate and Restart
Gradle 2.x is not available in the maven repository, so you have to provide other repos to satisfy all your dependencies, in settings.gradle:
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}

Categories

Resources