Why is gradle keeps downloading itself again and again with Android Studio? - android

I've downloaded Android Studio and using it for like a year, things get annoying when you repeatedly see gradle is being downloaded.
I have a built-in gradle distribution somewhere inside 'Android Studio.app'.
When I need to import a eclipse ADT project, it's downloading another gradle dist to
~/.gradle/wrapper/gradle-2.2.1-all/[WTFstring]/...
When I go to the project dir, and execute ./gradlew, again, it starts to download gradle.
And when I add ~/.gradle/wrapper/gradle-2.2.1-all/[WTFstring]/gradle-2.2.1/bin to
path, then execute 'gradle tasks' in the project dir, again, it's
again downloading gradle!!
Not sure if you have experienced something similar? This is really frustrating.

Enable offline mode in Android Studio to disable checking for updates everytime.
Go to Settings>Compiler>Gradle>Offline mode.
If this is enabled the gradle will be told not to connect to internet and check for updates.

Related

Android Studio build cannot delete path

I always have this in my Android Studio Windows 10. Every time I build my project and it just throw this.
Execution failed for task ':kruso:transformClassesWithDesugarForDevDebug'.
> com.android.build.api.transform.TransformException: java.io.IOException: Could not delete path 'C:\Users\Admin\Desktop\source_code\android\googleplayapps\Kruso\kruso\build\intermediates\transforms\desugar\dev\debug\0.jar'.
I tried several solutions i can find in stackoverflow but none works as expected. Here are the things I tried:
Deleting the build folder (Not working, Windows complain the folder or file is being used by another process)
Clean and rebuild project (Sometimes works, sometimes will still complain could not delete path. This is not applicable since it would take long time, ~4mins, to rebuild. If using Instant Run, it would just take 45s)
Restart Android Studio (This works, but restarting Android Studio for every build is just taking too much of time.)
p/s I'm using a Windows 10 powered by Intel i5-7200U, 12GB RAM, Android Studio 3.1.2
Simple Close the Android studio goto project Location and delete the folder from File explore, without starting an android studio.
If needed restart system and without starting any other program, goto project location and delete the folder.

New project in androidStudio makes many folders and a plugin errors. even after Reinstallation

In android studio when I create a new project, every time it makes many folders inside one another. I have every required sdk downloaded but even though it is giving an error "Install missing platform(s) and sync projects". Even after re-installation of android studio I'm facing the same issue. :(
go to File > settings > Appearance & Behavior > Android Sdk > under SDK platform, select the missing platform and apply.
If that doesn't fix it, go to the root folder of the project, remove the build folder from there.Then click on the app folder, and remove the build folder from there as well, and restart Studio.
If that also, doesnt fix the issue, update your gradle-wrapperproperties file under gradle scripts.
You can also downgrade the build tool version of your application from the gradle file. That will also fix the issue. However , it would be good practice to update it to latest.
let me know the result.

After moving Android Studio project to a different computer, the app wont run

I moved a project to a different computer by copying it to a flash drive and pasting it onto the new computer, and now when I try to run the app, it just says "App has stopped".
I already did Build > Clean Project, then Build > Build APK.
I haven't made any other changes to the code, and it ran fine on the old computer. How do I fix this?
Check the build.gradle files and the version of your sdk i think that will help you out...for example if the current sdk version is 25 and the copied file has 23 you need to change it to 25 to make it run
don't forget to sync and clean the project

Android studio 2.3 refreshing gradle project taking forever

I updated my android studio to the new version 2.3 and was asked to convert my project to match the new formats which I did. I was asked to update the gradle version too and I did. Now one eternity later it's still refreshing my project gradle. I've restarted it several times and I have active internet connection. Any suggestions
This method works for Me :
Change Gradle Home Path as C:\Program Files\Android\Android Studio\gradle\gradle-3.2
To Open Gradle Home Setting :
Settings->Build,Execution,Deployment->Gradle->Gradle Home
It depends sometimes on what are you building. As Hamid said, it´s a must do working Offline, it greatly reduces times, or at least it did not that long ago.
Also checkout that you are not building google APIs that you are not using, be careful with google's play-services or maps, they sometimes take a bunch of time and maybe you are not using them.
If that's an option, install Android Studio in a SSD, don't buy one, but if you have it, consider moving it, it reduced my gradle about 90%.
Also, check this, a bit old, but may help.
Could be caused by Microsoft Defender.
Check if msmpeng.exe is running in task manager
and exclude Android directory.
using default gradle wrapper and disconnecting from my corporate network to a 4G network solved my problem
File> Settings> Build, Execution, Deployment> Gradle> and check the Offline work
If you have an failed for sync gradle. Such as; Gradle sync failed: Minimum supported Gradle version is 3.3. Current version is 3.2.
Download Gradle supported version manually.
Uncheck "Use default gradle wrapper (recommended)"
Check "Use local gradle distribution" and set Gradle home path.
Check offline work.
Updating the gradle path in
File > Settings > Build, Execution, Deployment > Gradle
worked for me. The problem occured after updating Android Studio.

Android Studio starts downloading gradle

I have downloaded android studio and sdk and everything required but when I start a new project studio starts downloading gradle which is already downloaded with android studio. If I try to stop that download, it can't be stopped, I need to shutdown my laptop.
Please tell me why this happens!
And if I import any project then it shows a message that gradle build failed and tells me to install build tools API Level 7 which NOBODY uses now a days. What's wrong with this studio??
I am using Ubuntu 14.04, .gradle directory of my home folder has files of more than 300 Mb I don't understand what this android studio keeps downloading.
Please help me fixing this problem
That is normal one time download of maven gradle dependencies and packages. However it usually takes a long time to download and build. Not sure what are the reasons for this.
Android studio contains gradle essentials, but for some reasons that is insufficient to run command line tools.
There is a workaround to skip this download by adding gradle repo directory to android studio settings (Configure --> Settings --> Gradle). You have to manually add GRADLE_HOME to the system PATH variable according to your operating system. Run gradle-v in command line to confirm everything works right.

Categories

Resources