1,gradle is a new IDE programming environment with Android Studio integrated with Gradle IDE
2, to download gradle (for example, gradle-2.10) decompression. Configure environment variables. For example G:\Program files\android\android studio\gradle\gradle-2.10
3. Create a Gradle Project
cmd command line mkdir projectName, create project folder
Gradle init--type java-library. Creating modules written in the Java language
Gradle Init--type groovy-library; creating modules written in groovy language
4. View Build.gradle files in the project folder
/* * This build file is auto generated by running the Gradle ' init ' task * by ' user ' at ' 16-4-13 Trickle example 崍 2:05 ' with Gradle 2.1 0 * * This generated file contains a sample Java project to get started. * For more details take a look at the Java Quickstart chapter in the Gradle * User Guide available at https://docs.gradle. org/2.10/userguide/tutorial_java_projects.html *///Apply The Java plugin to add support for javaapply plugin: ' java '//' This section, you declare, where to find the dependencies of your projectrepositories { //use ' jcenter ' for resolving Your dependencies. You can declare any maven/ivy/file repository here.
Mavenlocal ()//MAVEN local library
maven{url ' XXXXX '}//maven
Mavencentral ()//direct to the Web under jcenter ()}//in this section you declare the dependencies for your production and test Codede pendencies { //The Production code uses the SLF4J logging API at compile time compile ' org.slf4j:slf4j-api:1.7.13 ' //Declare the dependency for your favourite test framework, you want to use in your tests. TestNG is also supported by the Gradle Test task. Just Change the //testcompile dependency to Testcompile ' org.testng:testng:6.8.1 ' and add //' test.usetestng () ' to your build script. Testcompile ' junit:junit:4.12 '}
5. Repositories is therefore the package configuration; Apply plugin: ' Java ' is the import Java module
6,gradle dependencies Download the corresponding package based on the configuration in the dependency
See the junit:4.12 and Org.slf4j-api unit test and log output packages downloaded.
Android Gradle Basic Practice