as升级到3.0多渠道打包和以前不一样了  

 

我就以图文展示描述下as 3.0打包的全过程

 

1.

友盟 as 3.0多渠道打包配置

 

2.

defaultConfig {
    applicationId "com.sxcoal"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 18
    versionName "1.1.8"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    flavorDimensions "versionCode"  //特别注意  不写这句话会出错  百度有很多解释  我就不复制了
}

3.

//签名
signingConfigs {
    release {
        storeFile file("../meitan.jks")//签名文件
        storePassword "123456"
        keyAlias "meitanchina"
        keyPassword "123456"
    }
}
//3.0 替换成all 了  下边是最简单的写法
applicationVariants.all { variant ->
    variant.outputs.all { output ->

        def outputFile = output.outputFile
        if (outputFile != null && outputFile.name.endsWith('.apk')) {
            def fileName = outputFile.name.replace(".apk", "-${defaultConfig.versionName}.apk")
            outputFileName = fileName
        }
    }
}

4.

多渠道配置

productFlavors {
    sxcoal {}
    yingyongbao {}
    xiaomi {}
    oppo {}
}

productFlavors.all {
    flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}

友盟 as 3.0多渠道打包配置

 

然后就可以了  

相关文章:

  • 2021-09-01
  • 2021-05-20
  • 2021-09-07
  • 2022-01-17
  • 2021-06-03
  • 2021-11-30
  • 2021-11-30
  • 2021-05-28
猜你喜欢
  • 2021-05-06
  • 2021-05-21
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案