weidingqiang

下一代Android渠道打包工具 https://github.com/mcxiaoke/packer-ng-plugin

另一个地址   http://www.open-open.com/lib/view/open1440248204395.html

apply plugin: \'com.android.application\'

apply plugin: \'packer\'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.weidingqiang.customnetroid"
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
//    buildTypes {
//        release {
//            minifyEnabled false
//            proguardFiles getDefaultProguardFile(\'proguard-android.txt\'), \'proguard-rules.pro\'
//        }
//    }

    signingConfigs {
        release {
            storeFile file("key.jks")
            storePassword "123456"
            keyAlias "hello"
            keyPassword "123456"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
        }

        beta {
            signingConfig signingConfigs.release
            minifyEnabled false
            debuggable true
        }

    }
}

packer {    // 指定渠道打包输出目录

    // archiveOutput = file(new File(project.rootProject.buildDir.path, "archives"))
    // 指定渠道打包输出文件名格式
    archiveNameFormat = \'${flavorName}-v${versionName}-${versionCode}-${buildTime}\'
    //appPkg = \'\'
    // 指定渠道打包需要修改的AndroidManifest文件项
    //manifestMatcher = [\'UMENG_CHANNEL\',\'Google_Play\']

}



dependencies {
    compile fileTree(dir: \'libs\', include: [\'*.jar\'])
    testCompile \'junit:junit:4.12\'
    compile \'com.android.support:appcompat-v7:22.2.0\'
    compile \'com.duowan.android.netroid:netroid:1.2.1\'

    compile \'com.mcxiaoke.gradle:packer-helper:1.0.2\'
}

配置完成后  配合友盟使用即可

在友盟中

如不想在manifest里配置友盟的channel,

可在Activity中配置:只需在程序启动时的Activity中调用此接口:

AnalyticsConfig.setChannel(String channel)

分类:

技术点:

相关文章: