android - 如何从模板更新 Android 项目?

标签 android templates project updates

目前我正在开发一个针对小型本地企业的应用程序,它可以作为其他应用程序(其他商店)的模板。基础应用程序允许本地商店向他们的客户发送通知,根据业务环境,通知可以是报告促销、通知客户他可以在商店取货、商店新产品通知等。 .. 我所做的是为每个客户制作模板,然后在后台自定义应用程序的外观,但每个人的功能都是相同的。我的问题是,每当我们有更多的企业对应用程序感兴趣时,当我发现错误或想要进一步改进时就会出现问题,并且更新每个应用程序中的代码可能会很糟糕(打开每个项目,添加行代码,重新编译等...),并且发布新的应用程序涉及到一项伟大的工作,因为我必须更改整个项目的 namespace ,更改内容提供者的权限,更新对与模板关联的 namespace 的引用等...

有什么方法可以让我在原始模板中提供更新和/或添加部分代码,并且更改会自动反射(reflect)在从模板生成的所有项目中?

我了解 Apache Ant 可以帮助编译具有许多依赖项的大型项目,但在我的问题上下文中可能有用吗?

我目前能想到的解决方案是创建一个项目库,然后把所有项目共有的东西,包括资源和Activity。问题是,例如,应用程序内容提供者无法到达那里,因为我需要在为每个应用程序定义的 list 中拥有单一权限。

非常感谢您花时间阅读我的消息。欢迎任何帮助或建议。再次感谢。

最佳答案

My question is there any way that I provide update and / or add portions of code in the original template and the changes are automatically reflected in all projects generated from the template?

将核心代码设为 Android library project ,并在所有客户应用程序中使用该库项目。

The solution that I can think of right now is to create a project library and then put everything common to projects, including resources and Activities.

正确。

The problem is that for example the application Content Provider could not go there because I need to have a single authority in the Manifiest defined for each application.

你的 ContentProvider实现可以在库项目中进行。您的客户特定项目将需要 <provider> list 中的元素,具有唯一权限,指向ContentProvider来自图书馆的类(class)。

关于android - 如何从模板更新 Android 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13119628/

相关文章:

c++ - 为什么会出现错误 "no matching function for call to ' A(A<...auto...> )'"?

c++ - Visual C++ 中的 win32 项目是什么?

Android:将可绘制的渐变设置为背景时,按钮上缺少高程

Android:如何从视频 (Uri) 获取缩略图

c++ - 运行时vs编译时多态性:更好的可读性vs编译时错误检查,还有什么更重要?

c++ - 从模板参数声明模板类中的函数指针

android - android数字签名是否改变?

java - Android开发中的类调用

java - 项目文件管理

ios - 你还能用 swift 2 在 xcode 7 中编程吗?