Read time out on build application - android

When I create Android project in Android Studio 3.1.2, I am getting the following errors:
read time out
and
org.gradle.api.resources.resource exception : could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar'
I download this file with browser.
How can I install manually?
How can I stop downloads for any project and download one time for all project?
Note: I am using hot spot shield and then I am creating a project.

It is Gradle issue nothing else ,
Delete your Gradle file and build your project again .

Try this
Go to build.gradle file which is at same level of your app folder. Inside you will get dependencies section just add
classpath 'com.android.tools.build:gradle:2.3.3'
as shown in below image

Try to update app level project gradle file.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

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

When I run a project I get the error:
Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
Required by:
project :
Add google Maven repository and sync project
Open File
my gradle file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.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
}
What can I do now?
The problem here is that the android tools plugin you want to use has moved. Old distributions are in jcenter, but new ones are at "https://maven.google.com"
Update your repositories to include "https://maven.google.com"
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
}
}
If you are in iran, china, etc... delete .gradle folder from android folder then try again with VPN.
Go to your gradle-wrapper.properties file in build.gradle and you will see the last line that specifies distributionUrl. Replace distributionUrl with below one.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
Let the download finish and your problem will be resolved. If you want to avoid the download reduce the version of com.android.tools.build:gradle:4.1.1 this to 4.0.0+ or 3.0.0+
in iran, china, north korea , Afghanistan delete .gradle and gradle folder from android folder then try again with VPN and download gradle
classpath 'com.google.gms:google-services:3.0.0'
Please add above under dependencies

Could not download auto-value.jar (com.google.auto.value:auto-value:1.5.2): No cached version available for offline mode

I have almost tried everything I know, but still as soon as I update my Android studio to the latest version it shows this error.What should I do?
The gradle.build is:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I faced the same problem today. I solved it by downloading the auto-value.jar file manually. Then I added the jar file to the libs folder. After doing so I synced the gradle files.
Here are details on how to add a jar file into Android Studio.
https://stackoverflow.com/a/16628496/8065933
All the best.

Gradle project sync failed in android studio 3.1

my gradle.build contains
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.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
}
and upon syncing project with gradle files is showing error as connection refused:connect .
There is a problem with Apply script build.gradle
Not able to resolve dependencies of classpath
Log file showing the below error
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)
Try using invalidate caches and restart in File Menu. Most of the time it works when studio have a new update.
Goto "File > Project Structure > SDK Location" menu and
Check "Use embedded JDK(recommended)".
It may be your JDK version problem.

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: Could not find com.android.tools.build:gradle:2.0.0-alpha2

Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview
After updating to the new version, my current working directory stop working at all. Every single time when I am trying to clean and build a project they will give me an error like this
Blockquote
'Error:Could not find com.android.tools.build:gradle:2.0.0-alpha2.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
Required by:
:android 3:unspecified'
Anyone have an idea how to solve this problem. Thanks in advance.
UPDATE: I am using a Mac machine and installation directory look like
Apparently the build tools have been moved from maven to jcenter so you need to change the code from:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
to this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
More details on the changes:
Android Tools Project Site
http://tools.android.com/recent
Android Developer Tools community https://plus.google.com/communities/114791428968349268860/stream/7f20992b-7d9a-4309-9d94-6fbe08f0ad6e
In the main build.gradle file, add jcenter() as main repo, just like that :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Remove other repositories or make sure jcenter is the first one.
On my side travis build failed with error message "Could not find com.android.tools.build:gradle:3.0.1".
After addeing google() as additional repository the problem was gone.
buildscript {
repositories {
jcenter()
google()
My local build did not fail because i had installed before "com.android.tools.build:gradle:3.0.1" with anddroid-sdk-manager
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
}
}
repositories block should be in buildscript.
Check to see if gradle 2.0.0-alpha1 is available on your system. Look in your android/tools/build/gradle folder. In my case, despite the confusing message "This project is using a preview version of the Gradle plugin (2.0.0-alpha2) and a newer version is available (2.0.0-alpha2) You can update to 2.0.0-alpha2." the version in my folder was 2.0.0-alpha1, and changing my build.gradle to:
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
fixed my build problem.
I removed the newest folder gradle-4.1-all in C:\Users\YOUR_USER_NAME\ .gradle\wrapper\dists\ and then I created a new project in Android Studio and the following message disappeared:
"Gradle sync failed: Could not find com.android.tools.build: Gradle:
3.0.0-beta6. "
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried something like
platfoms > android > cordova >lib > builders > Gradlebuilder.js
Downloaded zip and given path
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file\:///C:/MyPC/Documents/softwares/gradle-2.14.1-all.zip';
and linking path is
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven{url "http://jcenter.bintray.com"}
}
}
It worked for me.
this is for Ionic developers *
This seems to be a very long issue(years on the making)...most of the hints are about settings and gradle scripts. After a few days of digging around and backing from BumbleBee to 3.4.2 I kept on getting the same issue no matter what I tried. In the end the gradle on line URLs are blocked for my location due to network ... so easy for Google to say check the access is proper and not keep us blindfolded throwing darts in the dark

Categories

Resources