从一个项目构建多个 APK,以便在Play商店上传。

huangapple go评论62阅读模式
英文:

Build Multiple apk from 1 project, for upload in playstore

问题

我正在使用Java在Android Studio上开发一款学校应用程序。
我希望能够为每个学校生成带有学校名称和标志的多个APK文件(大约50+所学校)。
是否有办法节省时间,一次性生成所有的APK文件,
以便将来需要更新全部内容。

英文:

I am working on a app for school in android studio using java
I want to generate multiple apk for school with their school name and logo, (about 50+ schools)
Is there any way to save time generating one by one
in future need to update all

答案1

得分: 0

阅读关于productFlavors的官方指南。

> 创建产品风味与创建构建类型类似:将它们添加到构建配置的productFlavors块中,并包含所需的设置。产品风味支持与defaultConfig相同的属性,这是因为defaultConfig实际上属于ProductFlavor类。

productFlavors {
    elvispresley {
        applicationId 'your_package_id'
        versionCode 1
        versionName '1.0'
    }
    whitneyhouston {
        applicationId 'your_package_id_2'
        versionCode 2
        versionName '2.0.1'
    }
    projectOne {
        applicationIdSuffix ".one"
    }
    projectTwo {
        applicationIdSuffix ".two"
    }
}
英文:

Read official guideline about productFlavors.

> Creating product flavors is similar to creating build types: add them
> to the productFlavors block in your build configuration and include
> the settings you want. The product flavors support the same properties
> as defaultConfig—this is because defaultConfig actually belongs to the
> ProductFlavor class.

productFlavors {
        elvispresley {
            applicationId 'your_package_id'
            versionCode 1
            versionName '1.0'
            
        }
        whitneyhouston {
           applicationId 'your_package_id_2'
            versionCode 2
            versionName '2.0.1'
           
        }
        projectOne {
            applicationIdSuffix ".one"
            
        }
        projectTwo {
            applicationIdSuffix ".two"
            
        }
    }

huangapple
  • 本文由 发表于 2020年5月4日 17:43:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/61589271.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定