在Android的项目中使用开源库 [英] Using open source libraries in Android projects

查看:159
本文介绍了在Android的项目中使用开源库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android的编程初学者,而我与Android工作室工作...现在我徜徉什么是从GitHub安装公开来源库的最佳途径。
我的问题是从取景的组织原则点
我应该创建每个库一个新的包,并把所有的库源$ C ​​$ C作为在这个包?应包在该文件夹source.main.java? (该机器人工作室创建全自动的)。
对愚蠢的问题抱歉...它只是即时通讯采取了大规模的计划我的第一个孩子的步骤,我不想松动,因为不良组织的做法我未来的头上。

I'm a beginner in Android programing, and I'm working with android studio...now i wander what is the best way for installing open sources libraries from gitHub. my question is from organization principles point of view- should i create a new package for every library and put all the library source code as is in that package? should the package be in the source.main.java folder?? (the one that the android studio creates automaticly). sorry for the dumb question...it's just that im taking my first baby steps in a big scale program and i don't want to loose my head in the future because of bad organization practices.

推荐答案

有没有正确的答案。一些错误的方法去做,但常识会引导你。

There's no right answer to this question. A few wrong ways to do it, but common sense will guide you.

我的建议是:

有了这个开源$ C ​​$ C源开始的地方签入到公司的源代码控制系统,并能正在建设或重新构建需要。不一定在你的项目,但刚开code检查了,因此它不能丢失或原作者的GitHub上不断发展变化感到困惑。

Start by having the source of this open source code checked into your company's source control system somewhere and capable of being built or re-built as needed. Not necessarily in your project, but just getting the code checked in so it can't be lost or confused with the original author's ever evolving changes on GitHub.

至于你如何使用它,你有几种选择。

As to how you consume it, you have several options.


  1. 建立(从您的主项目签入源代码控制,但独立的),在它自己的项目开源。就拿编译后的文件(的.class,的.jar,的.lib等)的下降,并检查到您的主项目。这是最灵活的选择,如果你不认为你永远会需要经常改变开源$ C ​​$ C。有几个项目被管理的附带好处。

  1. Build the open source in it's own project (checked into source control, but separate from your main project). Then just take the drop of compiled files (.class, .jar, .lib, etc...) and check that into your main project. This is the most flexible option if you don't think you are ever going to need to change the open source code that often. Has the side benefit of being managed for several projects.

删除源$ C ​​$ C作为,直接到你的项目。这意味着你将永远是重建code。这给了最大的灵活性与发展和变化的具体的code到您的项目需求。

Drop the source code as-is directly into your project. This means you will always be rebuilding the code. This gives the most flexibility with evolving and changing the the code specific to your project needs.

有可能是这些选项的混合解决方案,以及

There's probably hybrid solutions of these options as well.

底线是,不管你使用需要复制并建设自己的系统。因为你从GitHub拉低了code可能会消失,或者在任何时候改变显著

The bottom line is that whatever you use needs to be copied and building in your own system. Because the code you pulled down from GitHub could go away or change significantly at any time.

这篇关于在Android的项目中使用开源库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆