简体   繁体   English

我们能否从一个项目中获得两个不同的apk(一个自定义和一个通用)

[英]Can we have two different apk(one custom and one general) from one project

I have developed an android application and am planning to publish it on play store. 我已经开发了一个Android应用程序,并计划将其发布在Play商店中。

However when i went to discuss it with a few people, i got custom requirements specific to their needs. 但是,当我与一些人讨论时,我得到了针对他们需求的自定义要求。

My question is, is it possible to generate two different apk files from the same code. 我的问题是,是否可以从同一代码生成两个不同的apk文件。 One would have the extra custom code and one without it. 一个将具有额外的自定义代码,而一个则没有它。 If so please guide me as to what approach needs to be taken for this or if there's tutorials for this, tell me what i need to look for. 如果是这样,请指导我有关该采取什么方法的指南,或者如果有针对此的教程,请告诉我我需要寻找什么。

Please read about Flavors in Android. 请阅读有关Android中风味的信息。

It should be exactly an answer to your problem. 它应该正是您的问题的答案。 this is mainly used for "free VS paid" use-cases but can be a perfect match for you. 这主要用于“免费VS付费”用例,但对您而言可以完美匹配。

Flavors works by defining two package names for the same code. 风味剂通过为同一代码定义两个包装名称来工作。

After setting 2 different Flavors, you can simply query with an if-else on the Flavor and do what you need depending on the "project" you are working on. 设置2种不同的风味后,您可以在风味上简单地使用if-else进行查询,并根据正在处理的“项目”执行所需的操作。

Android Flavors Android口味

Configure Build Variants 配置构建变体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM