Android库的最佳实践

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

Best practice for working on an android library

问题

我们有一些Android应用程序共享数据模型和其他内容。因此,我的计划是创建一个库,可以轻松扩展并在这些应用程序中实现,也可能在将来的应用程序中使用。

对于这个问题,最佳的方法是什么?

仅仅为了测试,我在其中一个应用程序中实现了一个模块。但这会导致一个问题,它与这个单一项目以及其版本控制绑定,这使得维护变得非常困难。而且这也不太实际,因为每个人都必须拥有并在这个应用项目上工作以进行库的更改。

我的想法是将它们分开,但如何分开呢?我已经进行了大量研究,但没有找到创建一个独立库的方法。到目前为止,我唯一找到的方法是创建一个全新的Android项目,然后在其中管理该库,将其与:app模块分开。但我不知道,这似乎不够直接。如何管理一个具有自己版本控制的库,可以让每个人都能轻松维护?是创建一个独立的Android项目是正确的方式吗?

英文:

We have some Android Applications which share data models and other stuff. So my plan was to make a library for that which can be easily extended and implemented in these Apps and maybe also in future Apps.

What is the best approach for that?

For just testing around, I implemented a module to one of the Apps. But this has the problem that it is bound to this single project and its version control which makes it a pain in the b_ to maintain. Also its not practicable to work on because everyone has to have and work on this App project for library changes.

My thoughts were to separate them but how? I have researched alot and didnt find a way to create a standalone library. The only way Ive found so far was to create a whole new Android Project and manage the library in it and seperate it from the :app Module. I dont know but this doesnt feels straight forward.
What is a good way to manage a library which has its own version control and can be easily maintained from everyone? Is the own Android Project the way to go?

答案1

得分: 1

你仍然可以为一个模块设置一个独立的版本控制系统,并在另一个存储库中进行维护。git-submodules是一个解决方法。

正如你所提到的,另一种方法是为库创建一个新的Android项目,并将其单独分发。这是一种非常简单直接的方式,但相对容易出错。

英文:

You can still setup a separated VCS for a module and maintain it in another repository. git-submodules is a way around it.

As you've mentioned, another approach is to create a new Android project for the library and distribute it separately. It's very straitforward way, but it's simple less error prone.

huangapple
  • 本文由 发表于 2023年2月6日 17:47:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359674.html
匿名

发表评论

匿名网友

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

确定