package_by_walle 1.0.2 copy "package_by_walle: ^1.0.2" to clipboard
package_by_walle: ^1.0.2 copied to clipboard

Packaging Android apps through multiple channels(based on walle)

package_by_walle #

flutter多渠道打包(基于walle

安装 #

package_by_walle: 1.0.2

配置 #

请务必按照步骤一步步配置,参考example目录

  1. 添加walle插件依赖:在android/build.gradle文件中添加
buildscript {
    repositories {
        // 不加这个会出现找不到插件的报错
        maven {
            url 'https://maven.aliyun.com/repository/jcenter'
        }
        maven {
            url 'https://maven.aliyun.com/repository/google'
        }
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        // 添加这一句
        classpath 'com.meituan.android.walle:plugin:1.1.7'
    }
}
  1. walle打包配置:在android/app/build.gradle文件最后添加。(channelFile 和 configFile 任选其一)
// 添加以下代码
apply plugin: 'walle'

walle {
// 指定渠道包的输出路径
apkOutputFolder = new File("${project.rootDir}/output/channels/")
// 定制渠道包的APK的文件名称
apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk'
// 1. channelFile形式(渠道配置文件)
channelFile = new File("${project.getProjectDir()}/channel")
// 2. 渠道&额外信息配置文件,与channelFile互斥
// 此配置项与channelFile功能互斥,开发者在使用时选择其一即可,两者都存在时configFile优先执行。
configFile = new File("${project.rootDir}/config.json")
}
  1. 在第二步中选择创建一种配置方式,然后创建对应的文件。(参考example/android目录)

  2. 命令行切换到android目录,运行打包命令

  • 多渠道打包:gradlew clean assembleReleaseChannels --stacktrace
  • 单个渠道打包:gradlew clean assembleReleaseChannels -PchannelList=meituan

使用 #

// 获取渠道号
String channel = await PackageByWalle.getPackingChannel ?? "test";

// 获取额外打包参数(configFile文件中配置)
Map info = await PackageByWalle.getPackingInfo;

问题 #

  1. Execution failed for task ':app:lintVitalRelease'
android {
    compileSdkVersion 30
    
    // 添加配置
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    
    // ...
}
  1. Could not find com.meituan.android.walle:plugin:1.1.7.
// 在 android/build.gradle 添加代码
maven {
    url 'https://maven.aliyun.com/repository/jcenter'
}
maven {
    url 'https://maven.aliyun.com/repository/google'
}
  1. 其他问题请提issue
3
likes
160
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

Packaging Android apps through multiple channels(based on walle)

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on package_by_walle