简体   繁体   中英

Android Studio: How do I find where Gradle has been installed?

I have installed Android Studio but would like to use Gradle to build a simple "hello world" Java application that I have created outside of AS.

I have added the java plugin to my build.gradle file and ran `"gradle build" to try and build the .java file.

However, I am getting the error: "Gradle is not recognised as an internal or external command"

Do I need to install a separate version of Gradle, not bundled with AS to be able to build a java project?

Do I need to install a separate version of Gradle, not bundled with AS to be able to build a java project?

More or less.

There are two ways of using Gradle:

  • Download and install it, like you would most other development tools

  • Have a project set up for the Gradle Wrapper ( gradlew and gradlew.bat files in the project root, plus the gradle/ directory containing the Wrapper JAR and properties file)

That latter approach will download a private copy of Gradle for this particular project, into the project's .gradle/ directory. This way, different projects can use different versions of Gradle without conflict.

Android Studio takes the latter approach; you can see the files that I mentioned in a newly-created Android Studio project, for example. For your own Java project, I'd do whatever is natural for your IDE that you plan on using for that project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM