android - How to tell Gradle to use a different AndroidManifest from the command line? -


i have multi-module project. root of project (which contains multiple modules), want able call 'gradle build' , have use different androidmanifest in 1 of modules depending on parameter pass in. what's best way accomplish this? should use gradle.properties file or can specify different build.gradle somehow in settings.gradle file? appreciated!

settings.gradle:

include 'actionbarsherlock' include '<main_app>' 

build.gradle:

buildscript {     repositories {         mavencentral()     }      dependencies {         classpath 'com.android.tools.build:gradle:0.4.2'     } }  apply plugin: 'android'  dependencies {     compile project(':actionbarsherlock') }  android {     buildtoolsversion "17.0"     compilesdkversion 17      sourcesets {         main {             manifest.srcfile 'androidmanifest.xml'             java.srcdirs = ['src']             resources.srcdirs = ['src']             aidl.srcdirs = ['src']             renderscript.srcdirs = ['src']             res.srcdirs = ['res']             assets.srcdirs = ['assets']         }     } } 

i'm looking best way use different androidmanifest.xml, 1 have in //test/androidmanifest.xml. , need able specify change command-line. ideas?

i solved using different build types.

here's build.gradle:

buildscript {     repositories {         mavencentral()     }      dependencies {         classpath 'com.android.tools.build:gradle:0.4.2'    } }  apply plugin: 'android'  dependencies {     compile project(':facebook-android-sdk-3.0.1:facebook')     compile project(':google-play-services_lib')     compile project(':nineoldandroids')     compile project(':slidingmenu-master:library')     compile project(':viewpagerindicator')     compile project(':volley')     compile project(':windowed-seek-bar')     compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar', 'libs/crittercism_v3_0_11_sdkonly.jar', 'libs/gcm.jar', 'libs/apphance-library.jar') }  android {     buildtoolsversion "17.0"     compilesdkversion 17      signingconfigs {         debug {             storefile file('keystores/debug.keystore')         }     }      buildtypes {         debug {             sourcesets {                 main {                     manifest.srcfile 'androidmanifest.xml'                     java.srcdirs = ['src']                     resources.srcdirs = ['src']                     aidl.srcdirs = ['src']                     renderscript.srcdirs = ['src']                     res.srcdirs = ['res']                     assets.srcdirs = ['assets']                 }             }         }          release {             zipalign true             sourcesets {                 main {                     manifest.srcfile 'androidmanifest.xml'                     java.srcdirs = ['src']                     resources.srcdirs = ['src']                     aidl.srcdirs = ['src']                     renderscript.srcdirs = ['src']                     res.srcdirs = ['res']                     assets.srcdirs = ['assets']                 }             }         }          utest {             debuggable true             signingconfig signingconfigs.debug              sourcesets {                 main {                     manifest.srcfile 'utest/androidmanifest.xml'                     java.srcdirs = ['src']                     resources.srcdirs = ['src']                     aidl.srcdirs = ['src']                     renderscript.srcdirs = ['src']                     res.srcdirs = ['res']                     assets.srcdirs = ['assets']                 }             }         }     } } 

you can see utest build, i'm specifying manifest in different directory. works.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -