我想为不同的通道生成不同的apks,所以build.gradle就像:
productFlavors {
playstore {
}
hip {
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
hip {
manifest.srcFile 'hip/AndroidManifest.xml'
}
playstore {
manifest.srcFile 'hip/AndroidManifest.xml'
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
但是当我建造它时,我得到了:
[AndroidManifest.xml:50, AndroidManifest.xml:50] Trying to merge incompatible /m
anifest/application/meta-data[@name=MobAd_CHANNEL] element:
<meta-data
@android:name="MobAd_CHANNEL"
-- @android:value="google market">
<meta-data
@android:name="MobAd_CHANNEL"
++ @android:value="hip">
:qingdaobus:processHipDebugManifest FAILED
FAILURE: Build failed with an exception.
所以我非常困惑,我真的想要它不同的频道值
答案 0 :(得分:1)
如果您只关心“playstore”和“hip”构建,只需在自己的AndroidManifest.xml中定义MobAd_CHANNEL,而不在main / src / AndroidManifest.xml中定义