Buildscript {repositories {mavencentral ()} dependencies {classpath ' Com.android.tools.build:gra dle:0.7.+ '}}apply plugin: ' Android ' repositories {mavencentral ()} dependencies {compile Filetree (dir: ' Libs ', Include: ' *.jar ')} android {compilesdkversion buildtoolsversion ' 19.0.0 ' defaultconfig {Minsdkversio N 9 Targetsdkversion} sourcesets {main {manifest.srcfile ' androidmanifest.xml ' Java.srcdirs = [' src '] resources.srcdirs = [' src '] aidl.srcdirs = [' src '] renderscr Ipt.srcdirs = [' src '] res.srcdirs = [' res '] assets.srcdirs = [' Assets ']} THREESIXO.S Etroot (' build-types/360 ') anzhi.setroot (' Build-types/anzhimarket ') baidu.setroot (' Build-types/baidu ') Hiapk.setroot (' build-types/hiapk ') jifeng.setroot (' Build-types/jifeng ') playstore.setroot (' Build-types/Play Store ') Tencent.sEtroot (' build-types/tencent ') wandoujia.setroot (' Build-types/wandoujia ') xiaomi.setroot (' Build-types/XiaoMi ') )//Move The tests to Tests/java, tests/res, etc ... Instrumenttest.setroot (' tests ')//Move The build types to build-types/<type>//For instance, Build-types/debug/java, Build-types/debug/androidmanifest.xml, ...//This moves them Out of them default location under src/<type>/... which would//conflict with src/being used by the main source set. Adding New build types or product flavors should be accompanied//by a similar customization. Debug.setroot (' Build-types/debug ') release.setroot (' Build-types/release ')} signingconfigs {MyConfig {StoreFile file ("E:\\my.keystore") storepassword "******" keyalias "MyApp" Ke Ypassword "******"}} buildtypes{release {Signingconfig signingconfigs.myconfig }} productflavors {threesixo {} Anzhi {} baidu {} hiapk {} jifeng{} pl Aystore {} tencent{} wandoujia{} xiaomi{ }}}
For example: Build-types\360\androidmanifest.xml
<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.mypackage"> <Application> <Meta-dataAndroid:name= "Umeng_channel"Android:value= "GooglePlay" /> </Application></Manifest>
Android Gradle multi-channel packaging