Original address: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7
Translation: Android Studio Chinese Group (sledgehammer translation)
Continued Gradle (i)
Project structure
Two major components (source sets): Main source code and test code. They are in the following two directories:
src/main/src/instrumenttest/
The two directories, respectively, have their own code source files and resource files.
java/resources/
For Android plugin, the following additional directories are available:
androidmanifest.xmlres/assets/aidl/rs/jni/
Configuring the project Structure
According to the Gradle documentation, there are two ways to reconfigure the project structure.
Sourcesets { Main { java { srcdir ' Src/java ' } Resources { srcdir ' src/resources ' } }}
Or:
sourcesets { main.java.srcDirs = [' Src/java '] main.resources.srcDirs = [' Src/resources ']}
And the Android project is similar, as shown in the following:
Android { Sourcesets { main { manifest.srcfile ' androidmanifest.xml ' java.srcdirs = [' src '] Resources.srcdirs = [' src '] aidl.srcdirs = [' src '] renderscript.srcdirs = [' src '] res.srcdirs = [' Res ']< C11/>assets.srcdirs = [' Assets '] } instrumenttest.setroot (' tests ')} }
Note: Setroot This method moves files and folders in all Src/instrumenttest directories to the tests/directory.
This article turns from http://www.android-studio.org/index.php/docs/guide/135-gradle-2
Gradle User's Manual (ii): Project structure