Android Studio ignores GRADLE_USER_HOME? - android-studio

I have Windows environment variables assigned
GRADLE_HOME=C:\Tools\gradle
GRADLE_OPTS=-Dgradle.user.home=C:/Tools/gradle
GRADLE_USER_HOME=c:\Tools\gradle
When running gradlew build from command line, all project dependencies are loaded to C:\Tools\gradle.
But if I make build from Android Studio, gradle uses C:\Users\MyUserName\.gradle directory.
AS bug?

Related

Is gradle installed with Android Studio on Windows?

I'm on Windows 10 and I have Android Studio installed and a version of the SDK installed. If I wish to use gradle on my command line(I'm running cordova requirement), how do I find out the path of gradle? If gradle is installed together with Android Studio that is.
Android Studio installs Gradle in a folder that looks like:
C:\Users\<username>\.gradle\wrapper\dists\gradle-7.0.2-bin\857tjihv64xamwrf0h14cai3r\gradle-7.0.2\bin
Please note that "7.0.2" is the gradle version, and this number may be different for you.
Find this path in you computer and add it to Windows "Path" environment variable. On Start Menu, type "environment variable", select "Path", click on "Edit" and add the gradle path to the list.
Restart "Command Prompt" (or PowerShell) before running cordova requirements again.

Location of gradle binary on Android Studio Install (Linux)

Where does a standard Android Studio install under linux place the gradle executable?
I want to run it from the cmd line, but can't find it to add to my PATH
By default Android Studio uses a Gradle wrapper. You can find the gradlew file in the project root. Check this link
If you want you can install your own Gradle version and use it by command line. In that case you can tell Android Studio to use that version instead of the wrapper

Android Studio aar module loads lint.jar only on IDE Start or Module import

When using Android SDK with the gradle build system, one can include an android.aar file as a sub-project.
Within the aar, one can supply a lint.jar that implements custom lint checks (Source).
When executing gradlew build within the project root on the command-line, my library.aar is exploded and the lint.jar within is used for the lint checks. Even when I update the lint.jar within the library.aar, it is updated in the lint cache and the new lint.jar is used for the checks when I call gradlew build again.
If I build the same project with the same gradle command from within Android Studio 1.5, the library.aar is only exploded once on Module Import or on the IDE Startup.
The lint.jar is never updated when I update the library.aar in my sub-project and the old lint.jar from the IDE startup is still in use.
Is this a bug or am I doing something wrong?
Currently I work around it by executing the gradle commands on the command-line, but it would be nice if Android Studio would work in these cases too.

android studio setting env variable PATH

Is there a way to change the environment variable PATH for building within Android Studio?
For command line builds, I set the PATH and run the gradle command. The build succeeds.
If I try to build from within android studio, the build fails, most likely because the build within Android Studio doesn't use the PATH

Migrate project to Gradle

I've got a project that used to be in Eclipse. I've since moved it from there into Android Studio, though it's not using the Gradle build system yet.
I've setup my gradle files so that I can do gradlew build from the command-line and it will generate an APK for me.
My question now is how do I get Android studio to build using the gradle files that I've got setup instead of the using the "old" way?
For what it's worth, I'm on Windows 7.
Not sure how you are compiling the project with Android Studio without actually using Gradle because AFAIK Android Studio always uses Gradle under the hoods to build sources.
Anyway, if you have your Gradle config file ready you only have to import it to a new project in Android Studio (File > Import Project... and then select the build.gradle or settings.gradle)

Resources