模块,库,jar,库项目,gradle项目,aar和jar之间的区别 [英] Difference between module, libraries, jar, library projects, gradle projects, aar and jar

查看:154
本文介绍了模块,库,jar,库项目,gradle项目,aar和jar之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一家拥有由离岸团队开发的android移动应用程序的公司工作。我有权访问GitHub存储库。



我一块一块地拼凑android应用程序,它给我地狱。



如何区分模块,库,jar,库项目,gradle项目,aar和jar。有人可以给我一个实际的定义。不是出于惊人的谷歌搜索。我也有谷歌。



是的我是一个noob,并且不为此感到骄傲。

解决方案

我只简单介绍一下这些内容。我希望我很清楚。

模块:模块是您的应用程序的一个组件,可以独立构建/测试并重用另一个应用程序(如果需要的话)。



库: AAR文件,JAR文件等。 $ b

JAR: Java库

AAR:就像JAR一样,唯一的区别是它也包含android特定的文件像资源等等。



Gradle项目: Gradle是Android Studio用来构建android项目的构建系统。它与Eclipse早期使用的构建系统相比非常强大。

Android应用程序项目,它还在项目的根目录中包含项目清单文件。此外,该目录还包含src,res和其他目录,这些目录在构建应用程序项目时也会找到。
但是,有显着的差异。您无法将库项目编译为APK文件,因为库项目没有描述应用程序。相反,当应用程序的项目和源代码引用库项目时,它提供了可重用的代码和资源,这些代码和资源对应用程序有贡献。在构建时,这些代码和这些资源被合并到应用程序的APK文件中。



为了解释更多,请给我一个例子:
假设您希望使用网络库volley进行API调用,现在因为这是来自Google的开源库,您可以根据需要克隆它以进行自定义。



您可以将抽象库作为您的图书馆计划,独立构建,单元测试等。

现在说你开始构建一个需要进行HTTP调用的应用程序,这样你就需要在你的项目中添加一个抽象库。您有两个选择:


  1. 编译您的库项目,生成aar文件并将其添加到您的应用程序Project中。


  2. 在项目中添加Volley作为模块。 (如果您选择此选项,您可以在同一个工作室项目中对排球库进行更改,因为它将作为项目中的组件)


请让我知道,如果有什么不清楚。


I work for a company which has a android mobile application developed by an offshore team. I have access to GitHub repositories.

I am piecing together the android app block by block and it is giving me hell.

How do I distinguish between module, libraries, jar, library projects, gradle projects, aar and jar. Can someone please give me a practical definition. NOT out of a freaking google search. I have Google too.

PS yes I am a noob and not proud of it.

解决方案

I'm just giving a brief description about each of these. I hope I'm clear.

Module : A Module is an component of your application that can build / test independently and re use it in another application if required.

Libraries : AAR files, JAR files etc.

JAR : Java library

AAR : Just like JAR, only difference is that it also contains android specific files like resources etc.

Gradle Project : Gradle is just a build system which is used by Android Studio to build the android project. Its very much powerful as compared to the build system which was used in Eclipse earlier.

Library Project : An Android library project is similar to an Android app project in that it also includes a project manifest file in the project’s root directory. Also, this directory contains src, res, and other directories that you also find when building an app project. However, there is a significant difference. You cannot compile a library project into an APK file because a library project doesn’t describe an app. Instead, it provides reusable code and resources that contribute to an app when the app’s project and source code refer to the library project. At build time, this code and these resources are merged into the app’s APK file.

To explain more on this, let me give you an example : Say you want to use a networking library volley for making API calls, now since this is an open source library from Google you can clone it making customisations as per your requirement.

You can make volley library as your Library Project, build it independently, unit test, etc.

Now say you started building an application where you need to make HTTP calls so you need to add volley library to your project. You have two choices for that :

  1. Compile your library project volley, generate the aar file and add it your app Project.

  2. Add Volley as module in your project. (If you choose this option you can make changes to volley library in same studio project since it will act as a component in your project)

Please let me know if something is not clear.

这篇关于模块,库,jar,库项目,gradle项目,aar和jar之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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