1.在项目下的build.gradl配置渠道

1.普通版

//android studio  3.0之后才有(才需要加这个flavorDimensions "default")

flavorDimensions "default"

productFlavors {

baidu {

manifestPlaceholders = [CHANNEL_KEY:"baidu"]

}

huawei {

manifestPlaceholders = [CHANNEL_KEY:"huawei"]

}

xiaomi {

manifestPlaceholders = [CHANNEL_KEY:"xiaomi"]

}

googleplay {

manifestPlaceholders = [CHANNEL_KEY:"googleplay"]

}

wandoujia {

manifestPlaceholders = [CHANNEL_KEY:"wandoujia"]

}

}

2.升级版

//android studio  3.0之后才有(才有加flavorDimensions "default")

flavorDimensions "default"

productFlavors {

m360 {

}

googleplay {

}

xiaomi {

}

lenove {

}

huawei {

}

gfan {

}

}

productFlavors.all {

flavor -> flavor.manifestPlaceholders = [CHANNEL_KEY: name]

}

2.在菜单栏Build下Generate Signed APK,输入密码,next...next...

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐