Yriuns
Yriuns

Reputation: 775

gradle, what does this mean? "debug.setRoot('build-types/debug')"

Here is my gradle setting:

    sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src/main/java']
        resources.srcDirs = ['src/main/java']
        aidl.srcDirs = ['src/main/java']
        renderscript.srcDirs = ['src/main/java']
        res.srcDirs = ['src/main/res']
        assets.srcDirs = ['assets']
    }
    instrumentTest.setRoot('tests')

    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}
buildTypes{
    release{
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    debug{
        minifyEnabled false
    }
}

I coundn't find the build-types/debug folder and build-types/release folder although I set these debug.setRoot('build-types/debug') release.setRoot('build-types/release')

what's wrong?

Upvotes: 2

Views: 1811

Answers (1)

amenon
amenon

Reputation: 358

The setRoot method is used to set the path for a specific build-type's configuration. So you have specific configuration for debug and release, you will need to create those folders and put the build-type specific files in there. With your current configuration, you are saying that all the common files are in the main build type, and any build-type specific files will be in the folders that you are specifying.

That being said, you are better off using the recommended project structure that the android plugin supports. See the documentation for this. It will keep your build.gradle file clean if you follow the conventions.

Upvotes: 2

Related Questions