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.xml
res/
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 '] assets.srcdirs = [' Assets '] } Instrumenttest.setroot (' Tests ') }}
Note: Setroot This method moves files and folders in all Src/instrumenttest directories to the tests/directory.
[Transfer]-gradle user manual (ii): Project structure