我想为不同的频道生成不同的 apk,所以 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.
所以我很困惑,我真的想要它不同的频道值