error:Connection reset (Gradle sync failed: Connection reset) - android

I am importing constraint-layout-start to android studio 3.0. I have kept in androidstudioproject folder that's the the path where all my android studio projects are stored. after importing its showing connection reset error. Here is the log file link: https://drive.google.com/file/d/1W1mGmIc67baZb4C5nGGecWm15ggB0Wp5/view?usp=sharing
i have all the SDK installed. tried to manually change the sdk verion to 21 which was running perfectly for my other projects, but here it didn't work.
i checked all the files are okay, i am not getting why this error occurs.
images of gradle page are given below.
build.gradle
gradle

Add google repository to your gradle file:
repositories {
maven()
//other repositories...
google()
}
Try to download from SDK manager:
SDK Manager Android Studio
Check your gradle and plugin version:
https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle

For Android studio 3.0.0
required Gradle version: 4.1
File > Project Structure > Project
required Build Tools 26.0.2

For Android Studio 3.4 Canary 8
Hope it will helpful!
Go To File>Settings>Build, Execution, Deployment>Gradle
and set your Android studio local gradle path like below image

i solve this problem in this way. be careful it causes with different problems like using proxy, dns connection windows , fire wall block , ....
anyway, i use proxy in file/settings/proxy in android studio and after that i set no proxy. after that whenever use kerio vpn or cisco gradle didnt work.
solution :open gradle.properties and remove every proxy script from there and sync gradle and work fine

Related

Setting up gradle and gradle plugin and dependencies in in android studio

After installing arctic fox on linux, I tried to create a new project but was told there was no gradle and it wanted to download one. Not having a great internet connection I downloaded gradle 6.9.2 and I pointed the gradle to the folder.
It's apparently not enough to just have gradle but it needs a plugin as well. Which gets specified in project structure - project. None of the options in project structure work but manually setting version 3.5.3 in the build.gradle does.
The issue I have now is that I have no idea where the 3.5.3 comes from? Is there a folder where all these plugins are installed where one can check what is available?
I'm having the same issue with other dependencies where just starting a new project requires that I re-download all the dependencies again despite the fact that I can open another project and it builds just fine.
The plugin version depend on gradle plugin. You can see version require docs from here: https://developer.android.google.cn/studio/releases/gradle-plugin
And plugin will be downloaded from google maven repository: https://maven.google.com/web/index.html#com.android.tools.build:gradle
You can also find them on your local maven cache directory.

Gradle not compiling dependencies

I'm trying to execute the "Hello World" example from Android Studio but I get this error
Android Studio: 1.5.1
Gradle: 2.12
Apache Ant: 1.10.3
I have no admin privileges and I'm under a proxy (I got the configuration IP, user/pass correctly added in the settings section).
Here are some screenshots.
Thanks in advance for your help!
Old configuration, old Android studio. Update to the newest official one:
Android Studio: 3.1.2, Gradle: 3.1.2
Also edit the file gradle-wrapper.properties and change the url to this:
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
And delete all directory versions of gradle in the directory .gradle\, like .gradle\4.1, .gradle\2.12, and so on.
After that, try to sync your project again and clean+rebuild the whole project.

Android Studio 3.1 Gradle Plugin 4.4 KotlinNullPointerException

Surprisingly, my project is completely written and developed in Java only, it's also not containing any dependencies declared for Kotlin. Yet I'm receiving this weird error:
A problem occurred configuring project ':app'.
Configuration:
When I use the below configuration, it works perfectly fine, builds the project and the app gets installed on my device/emulator:
Android Studio Version: 3.1 Stable release
Gradle Plugin Version: 3.0.1
Gradle Distribution URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
BUT When I use the latest configuration declared below, the error occurs while running the app as shown in the images:
Android Studio Version: 3.1 Stable release
Gradle Plugin Version: 3.1.0
Gradle Distribution URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Steps I've followed/things I've tried:
Clean Project
Rebuild Project
Sync Project
Deleting build folder from project tree
Checked that project doesn't contain any names, references or declarations missing
Invalidate Caches/Restart
Check the whole dependency tree to make sure any Kotlin dependency is not imported or used as my project doesn't make use of Kotlin language
None of the above have worked!
I think instant run might be creating issue .
Do one thing disable instant run in android studio and try again .I think it might will resolve issue .
Try to update Android Studio. Turn off Instant Run from Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run.

How I can sync gradle using downloaded archive in android studio

I install android 2.3.3, but i cant sync gradle because I dont have internet connection. But i have downloaded gradle archive, how I can sync gradle using this archive?
You can try doing this inside Android Studio, I'm using version 2.3.3 -
Preferences -> Gradle -> Global Gradle Settings -> Offline work
But you have to build it online once to be able to do this later.
Check this SO Post for more information.

Gradle version 1.6 is required. Current version is 1.8-20130730220035+0000

Just updated Android-Studio to version 0.2.7 an now I get the error message from the title:
In the log window there is link to the grade setup:
No matter which option I use the error message stays the same.
I deleted my ~/.gradle directory and projects **/.gradle directories.
It seems that nothing helps.
Nitpick: compile on the command-line using \opt\gradle\1.6\bin\gradle.bat build works fine.
Go to Preferences > Project Settings > Gradle and choose "Use gradle wrapper" instead of the bundled option
Open your gradle-wrapper.properties and change the distributionUrl to use 1.7 if it is not already (mine was 1.6), i.e. distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip
I managed to fix my project through some combination of invalidating Android Studio cache, deleting .idea and .gradle directories and .iml files, restarting Studio, and reimporting the project:
on Mac OSX using Homebrew, brew install gradle then pick local gradle distribution and point to /usr/local/Cellar/gradle/1.7/libexec for gradle home:
You do not want to manage gradle at a system level, it is better handled per project. Android Studio projects already setup gradle wrapper handling when creating new projects but if you have an older one you can add the same file that Android Studio does. Think of this as an gradle bootstrap file that will download the correct gradle version per project. You can also read up on Gradle Wrapper and generate a shell script called gradlew that will provide gradle-free bootstrapping.
In gradle/wrapper/gradle-wrapper.properties in your project directory make sure you have:
#
#Tue Oct 08 13:40:54 CEST 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip
Then when you go into Gradle you can set it to use the gradle wrapper. This is the default when creating new projects in Android Studio.
There are at least three approaches to migration or adding Gradle properly and using the new project structure Google and Android Studio has introduced.
Create a new project and copy over the code
Export from Eclipse to Gradle (deprecated)
Import code into Android Studio (recommended)
Try to manually get everything in order by creating the correct gradle files and reorganizing the project.
For now I'm copying the files over to a new project until the tools get a bit better.
We have two computers, one of which gave that same message after upgrading to Android Studio 0.2.7. We noticed that the computer which could still build had Gradle installed independently of Android Studio.
Installing Gradle 1.6 downloaded from the Gradle web site fixed this issue on the computer that wouldn't build.
My fix was basically what Abe did but I wanted to give a bit more explanation:
Download gradle 1.6 from the gradle website
Extract somewhere on your pc/mac
Open up android studio, go to Preferences -> Gradle (left panel) -> and chooose Local gradle distribution.
Point Gradle home to the location where you extracted gradle.
This fixed the issue for me. Using the gradle wrapper and the bundled gradle distribution both failed
In my case, i updated gradle to the latest version (1.8) and then changed the gradle.build files (for my project and for the libraries i was using) like these:
dependencies {
classpath 'com.android.tools.build:gradle:0.6.1+'
}
The Synchronize files and Refresh/Invalidate cache. This seems to solve the problem. I think that Gradle in order to determine the minimum required version just reads the above value.
Here's what I did to get my project working:
Installed Gradle 1.7 on my OS (OS X users can use brew for this)
Added this to my local.properties file: sdk.dir=/Applications/Android\ Studio.app/sdk
Created gradle wrappers with gradle wrapper command.
Chose "Use gradle wrapper (recommended)" option in Android Studio.

Categories

Resources