开发中不同的渠道包需要使用不同的AndroidManifest.xml,比如Flavor1 需要添加android:sharedUserId="android.uid.system"配置,可以新建一个AndroidManifest_system.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:sharedUserId="android.uid.system">
</manifest>
在gradle中配置:
sourceSets {Base {manifest.srcFile 'src/main/AndroidManifest.xml'}Flavor1 {manifest.srcFile 'src/main/AndroidManifest_system.xml'}}
Flavor1 渠道打包会融合AndroidManifest.xml和AndroidManifest_system.xml两个配置文件