Android Studio download gradle takes forever - android-studio

Everytime an imported project requires a specific version of gradle I don't have, it starts to sync. At this time, I close Android Studio, connect to vpn, and reopen Android Studio to sync gradle; however, sync never ends. Then I go to .gradle/wrapper/dists/gradle-xxx-all and nothing is downloaded (zip.part 0Kb). When I connect to vpn I can access gradle.org and download manually. Is this a bug with Android Studio or gradle?
There are many similar questions and most are solved by manually downloading the zip package. None solve the problem completely, though.

Follow below step to set automatically gradle sync in your android studio.
File -> Settings -> Build,Execution,Deployment ->Build tools -> gradle ->
check Use Default gradle wrapper(recommended) radiobutton.
Also follow below step to restart your android studio for invalid cache restart.
File > Invalidate Caches/Restart (you can also manually remove the cache at ~/Library/Caches/{yourIDEName} and restart the IDE)
Then save settings and rebuild your project.
Edit: See Android 1.5 Gradle Sync never completes to get more idea.
I hope its helps you.

Related

Indexing freeze with message: Indexing paused due to batch updated

I've updated Android Studio to version 3.2.
After that update one of my projects don't want to index.
It freezes with the message
"Indexing paused due to batch update".
How can I fix this?
File gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
File gradle-properties:
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true
I faced the same issue with Android Studio 3.2. Invalidated the cache and restarted Android Studio, but it still did not work for me. Then I just re-imported the project and it worked!
Just Restart (File > Invalidate Cache & Restart > Just Restart)
I faced this issue in Android Studio 3.+ when forcefully close Studio in between some gradle process.
Pressing the play button worked for me. It finished indexing and installed the apk in seconds. The catch is that I have to do this every time and batch does not seem to update.
Click on the play button to the right of the progress bar.
Press the play button to the right of this message and the issue would resolve.
You have to do it every time, because right now the problem is systematic and there is no solution to stop it from appearing.
I invalidated the cache and restarted Android Studio. That worked for me.
You can do this by:
File > Invalidate Caches / Restart > Invalidate and Restart
I faced this issue many times and what I did everytime is:
Firstly, click on the processing bar on the bottom of the android studio.
A pop up window will appear on the screen like this-
Click on the red circled Play button and let the process complete.
Please note that you will have to repeat this everytime you face this issue because this is some kind of bug or something in AS version 3.2
Optional: click on (-) minimize button if you want to the pop-up to minimize
I faced the same issue, it seems that Android Studio messes up the cache.
Go to File > Invalidate Caches and Restart
Then on the Pop Up that appears choose Invalidate and Restart
Seems like there is an issue with Android Studio itself. I fixed the issue for now by following these steps:
Click File > Invalidate Caches / Restart
On the pop up choose Invalidate and Restart
Invalidated the cache -> restarted Android Studio -> re-import the project from the project location. Its worked for me
This is an issue in Android Studio since v3.2, I have posted an issue in Android Studio Issue Tracker, it's being finally accepted. Waiting for them to solve it.
Here is the issue tracker, you can follow up from here.
please star the issue as well to help solving it.
Stay Connected to internet.Let the batch to be updated.Wait one time and it will be easy the next time. OR...Click on the play button.
I saw this error and none of the solutions posted here worked for me. I had a specific scenario (see below), and I could get rid of the problem in my specific scenario. Not sure if the OP had the same scenario, by here are my two cents:
In my specific case I had two projects open in Android Studio, where one of the project was from a sshfs-mounted directory (the other project was local to my computer). I believe that made Android Studio throw the "Indexing paused due to batch updated" message on, strangely, both the projects.
To get rid of the error on the local project, I had to close the remote mounted project. On closing that project, the message was gone for my local project.
Hope that helps.
Close your project
Go to your project root directory,
Find and delete the xxx.iml file, the .idea and .gradle folders
Re-open your project using Android Studio.
I had the same issue and I fixed by do the following:
Click File --> click on Invalidate Caches / Restart
You will see a pop up--> select Invalidate and Restart
I did it by exporting the project into zip file and open it like normal. you can export by clicking the file navbar and choose export to zip file
I faced the same Issue but the situation which lead to this was different:
I created a remote branch on the project's repository on GitHub and it was empty.
And then I checkout to that branch locally while android studio was running.
I then deleted the local repository and created it again but this time it was not empty. Further I pushed the code to the remote branch as well.Now I thought that it will start the project normally but again the same happened.it resulted in an IDE error.
To solves this issue I deleted that local repository and again re-imported it.Than it started correctly.
None of the other answers worked for me. Not even pressing the "play" button. All that worked was closing the project and re-opening it via "Open an existing Android Studio project".
The effect only lasts for a single session. As soon as I close and re-open the project, or AS 3.3, the problem re-appears.
Deleting C:\Users\<user>\.AndroidStudio3.3\config\options\recentProjects.xml (before starting AS 3.3) is an alternative way to accomplish the same thing.
EDIT
Upon upgrading to AS 3.3.2, this solution no longer worked. However, after an "Invalidate Caches and Restart", the problem disappeared.
Click on play button twice and then go to file->Invalidate Caches / Restart...
repeat this process every time whenever you face this issue.
I solved it by deleting all the *.iml files and the .idea folder
I faced the same issue, because my AS version is not the same with gradle plugin's version.
This issue coccus randomly in Android Studio V3.+ [Issue tracker:https://issuetracker.google.com/issues/118523471] .
There might be multiple reasons for this issue but it is mainly either ".gradle" related or ".iml" file related IntelliJ/Android Studio configurations.
Possible solutions:
Click on play icon under the processing bar (on the bottom of the android studio). But be aware that multiple clicks may also kill the the indexing process.
Invalidate cache (File -> Invalidate Cache & Restart -> Just Restart)
Clean ((Build -> Clean project) and Rebuild (Build -> Rebuild Project)
Sync Project with Gradle Files: Available options (depending on the Android Studio version) at
Tools -> Android -> Sync Project with Gradle Files
button available at top left corner in Android Studio's toolbar
File -> Sync Project with Gradle Files
Delete the .idea & .gradle folders and .idea & .iml files from the project root directory and re-import the project
I have faced this issue quite a few times and got rid of then by using one or more of above solutions.
But in some scenario nothing of the above solutions may work (as recently I get trapped-in). In this case I have to recreate the same project from scratch and copied back the required files into it. But ideally this should not be the solution. Please let me know if any other possible solution is there.
Invalidate cache and restart did the work for me. Now, the build is compiling in seconds.

Android Studio Gradle Showing No Cached Version available

I have just updated to Android Studio 3.1.4 and now it is showing
"No cached version of com.android.tools.build:gradle:3.1.4 available for offline mode"
And if I turn off offline mode it is showing another error in loading dl.google.com/....
I want to run Android studio without Internet Connectivity.
How to solve this
You probably checked the offline mode in:
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle.
Uncheck the option Offline work and you'll be good to go.
Edit:
In fact, you’ll need to get connected to the internet for the first time downloading the dependencies-packages-meta files and etc. Then after, you’ll be able to use Android Studio offline if you don’t change the Build.gradle.

Google Play Instant Development SDK Update Fails

Android Studio 3.2 RC3 keeps asking me to update the Google Play Instant Development SDK (from 1.3.0 to 1.4.0), but it always fails the update with this message:
Failed packages:
- Google Play Instant Development SDK (extras;google;instantapps)
How can I fix this?
Close Android Studio completely
File -> Close.
Delete instantapps Folder form your sdk:
C:\Users\xxx\AppData\Local\Android\Sdk\extras\google\instantapps
update again.
read more http://syscurity.blogspot.com/2018/09/failed-packages-google-play-instant.html
I was able to get this working by:
Closing my project (File -> Close Project)
Open SDK Manager from the gear at the bottom of the window
Click Updates on the left
I had to do this twice and it worked the second time.
If that won't work you can try File -> Invalidate Cache/restart -> Invalidate Restart. Android Studio will close and restart and then updates should install properly.
After delete, you reinstall here "Instant"
find the SDK folder instalation,
go to extra-google-instantaps, delete that
folder instantaps
and after that update again with sdk manager, that
old version is the problem
Solved this (in a similar way to previous, with one exception) by
1: Closing Android Studio File -> Close
2: deleting .installer and tools folders in C:\Users\xxx\AppData\Local\Android\Sdk\extras\google\instantapps
3: Launching SDK Manager from Configure dropdown beside gear icon
Note: I tried deleting the entire instantapps folder but when I did this I did not get presented with the option to
install Instant Development SDK.
Close Android Studio
Go to the SDK installed folder
C:\Users\xxx\AppData\Local\Android\Sdk
or maybe you installed in another drive
Then go to extras\google\instantapps and delete this instant apps folder.
Now open Android Studio
Tools -> SDK Manager -> SDK Tools -> Check the box before
"Google Play Instant Development
SDK"
Click Apply and ok
Enjoy your problem free life.
If your version of Android Studio is 3.2, you can go to C:\Users\xxx and delete the version folder other than <.AndroidStudio3.2>. I did this and it succeeded.
Just needs Administrator privilege to install. Try run Android studio as administrator.

Android studio suspended on indexing

When i run android studio it freeze on indexing and show me message:
indexing suspended (context: Gradle Sync)
it take more then 42 min and still show me this message i can't stop process and almost every thing is disable
Solutions I've tried
1- enable offline mode
2- select local gradle
3- invalidate caches/ Restart
but no one of this is solve my problem .
I've solved closing project (Menu File -> Close Project) and reopening it selecting his build.gradle.
Hope that helps
In my case, syncing the project with file system helped. But the project uses react-native and many gradle modules are located in the node_modules folder which could be updated by yarn/npm.

Android Studio - automatic gradle sync at startup

Yesterday I updated the Android Studio to 2.2 (from 2.1.3). Since that the Android Studio always start gradle sync at startup on every opened projects. I found this question and I tried Mick's suggestion, but unfortunately that did'nt worked for me.
If I open Android Studio, and I wait until load my projects, sync gradle and then I close Android Studio (without any change on my projects), and after that, I open it again, AS also do the same as before (run a gradle sync again senselessly).
I think, this is not a serious problem, but it's pretty weird, because it sync senselessly (otherwise I start gradle sync manually if I need to, but AS start it on every startup senselessly), and I need to wait little more to start coding (a little waste of time and energy).
Maybe this is what you want.
gradle --stop

Resources