Android 开发时,有时针对不同的应用市场,可能会打包一些不同的资源,一般的多渠道打包可以参考:“多渠道打包”
但是,有时候也需要针对不同的渠道,使用不同的依赖,这时,可以在build.gradle中的dependencies中这样设置:
使用Flavor名+Compile来指定Flavor对应的所需依赖:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
//谷歌
googleCompile 'com.android.support:design:22.2.0'
//豌豆荚
wandoujiaCompile 'com.jakewharton:butterknife:6.1.0'
//百度
baiduCompile 'com.amap.api:search:latest.integration'
//腾讯
tecentCompile 'com.google.code.gson:gson:2.2.4'
//华为
huaweiCompile 'com.facebook.fresco:fresco:1.11.0'
}
然后Sync一下,再打包。