Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize a BuildType with the configuration of an existing BuildType?

Tags:

android

gradle

I want to configure a third BuildType in my project that inherits all the configurations from another BuildType.

How can I do this?

like image 256
Janusz Avatar asked Dec 04 '22 04:12

Janusz


2 Answers

Just use the initWith property with in the build type:

uitesting {
     initWith debug         
}

You can find more information on the respectively developer page: https://developer.android.com/studio/build/build-variants#build-types

As an alternative you can also use:

<<new_build_type>>.initWith(buildTypes.<<old_build_type>>)

In a real case this looks like:

uitesting.initWith(buildTypes.debug)
uitesting {
...         
}
like image 157
Christopher Avatar answered Dec 10 '22 13:12

Christopher


Use jnidebug.initWith(buildTypes.debug) to inherit properties of another build type

Please try something like this

    android {
    buildTypes {
        debug {
            applicationIdSuffix ".debug"

        }

        jnidebug.initWith(buildTypes.debug)
        jnidebug {
            packageNameSuffix ".jnidebug"
            jniDebuggable true
        }
    }
}

This might be helpful http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types

like image 38
Rohit5k2 Avatar answered Dec 10 '22 12:12

Rohit5k2