apply plugin: \'com.android.application\' def app_label //app名字 def app_icon //app图标 def app_applicationId //app id def app_main //main页面 全路径 def app_name //app的application全路径 android { defaultConfig { flavorDimensions("app") productFlavors { main_ { //空文件夹 做主包 dimension "app" app_applicationId = "com.example.main"//马甲包应用id app_label = "@string/main" app_icon = "@drawable/main" app_main = "com.example.win10_jycainiao.test.MainActivity" app_name = "com.example.win10_jycainiao.test.MainApp" applicationId app_applicationId versionCode 1 versionName "1.0" manifestPlaceholders = [ //AndroidMainfest.xml文件拿值 MY_LABEL: app_label, //马甲包 应用名称 MY_ICON : app_icon, //马甲包 应用图标 MY_MAIN : app_main, //马甲包 主页面全路径 MY_NAME : app_name, //马甲包 application全路径 ] buildConfigField("String", "APPTAG", "\"main\"")//代码拿值 } majiabao1 { //马甲包1 dimension "app" app_applicationId = "com.example.majiabao1"//马甲包应用id app_label = "@string/majiabao1" app_icon = "@drawable/majiabao1" app_main = "majiabao1.MainActivity1" app_name = "com.example.win10_jycainiao.test.MyApp1" applicationId app_applicationId versionCode 1 versionName "1.0" manifestPlaceholders = [ //AndroidMainfest.xml文件拿值 MY_LABEL: app_label, //马甲包 应用名称 MY_ICON : app_icon, //马甲包 应用图标 MY_MAIN : app_main, //马甲包 主页面全路径 MY_NAME : app_name, //马甲包 application全路径 ] buildConfigField("String", "APPTAG", "\"majiabao1\"")//代码拿值 } majiabao2 { //马甲包2 dimension "app" app_applicationId = "com.example.majiabao2"//马甲包应用id app_label = "@string/majiabao2" app_icon = "@drawable/majiabao2" app_main = "majiabao2.MainActivity2" app_name = "com.example.win10_jycainiao.test.MyApp2" applicationId app_applicationId versionCode 11 versionName "121.0" manifestPlaceholders = [ //AndroidMainfest.xml文件拿值 MY_LABEL: app_label, //马甲包 应用名称 MY_ICON : app_icon, //马甲包 应用图标 MY_MAIN : app_main, //马甲包 主页面全路径 MY_NAME : app_name, //马甲包 application全路径 ] buildConfigField("String", "APPTAG", "\"majiabao2\"")//代码拿值 } } compileSdkVersion 29 minSdkVersion 19 targetSdkVersion 29 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(\'proguard-android.txt\'), \'proguard-rules.pro\' } } } dependencies { majiabao1Implementation \'com.android.support:appcompat-v7:28.0.0\' majiabao1Implementation \'com.android.support:support-compat:28.0.0\' majiabao2Implementation \'com.android.support:appcompat-v7:28.0.0\' majiabao2Implementation \'com.android.support:support-compat:28.0.0\' main_Implementation \'com.android.support:appcompat-v7:28.0.0\' main_Implementation \'com.android.support:support-compat:28.0.0\' }
马甲包、多渠道打包 demo
内容版权声明:除非注明,否则皆为本站原创文章。