[Transfer]-gradle user manual (ii): Project structure

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.