简体   繁体   English

添加外部jar和使用库项目有什么区别?

[英]What is difference between adding external jar and using library project?

What is difference between adding external jar and using library project in android? 添加外部jar和在android中使用库项目有什么区别? can we extract jar from library project and import it as external jar in our main application? 我们可以从库项目中提取jar并将其作为外部jar导入到我们的主应用程序中吗?

What is difference between adding external jar and using library project in android? 添加外部jar和在android中使用库项目有什么区别?

There is almost no difference in achieving a task between these two except a minor digression. That is if you add jar, you have to go with whatever defined in that external jar and the features that jar provides can't be changed. 也就是说,如果添加jar,则必须使用该外部jar中定义的任何内容,并且jar提供的功能无法更改。 If you include library project, you can play with the source code and make changes to the features if you don't want to go with the default features. 如果您包含库项目,那么如果不想使用默认功能,则可以使用源代码并更改功能。 Both have their own cons and pros. 两者都有各自的优缺点。 As I said, by including library project, you can customize the features, but you may not know whether if affects any other things that depends on the feature you are playing with. 正如我说过的,通过包含库项目,您可以自定义功能,但是您可能不知道是否会影响取决于您使用的功能的任何其他因素。 But that's not a big deal if you are very wary. 但是,如果您非常警惕,那没什么大不了的。 Adding a jar wouldn't let you customize but then again it's easy to follow the pre-defined features :). 添加一个jar并不能让您自定义,但是再次遵循预定义的功能很容易:)。 Hope this helps. 希望这可以帮助。

For your second question: can we extract jar from library project and import it as external jar in our main application? 对于您的第二个问题: 我们可以从库项目中提取jar并将其作为外部jar导入到我们的主应用程序中吗?

Not exactly, but you can. 不完全可以,但是可以。 See this great answer given by CommonsWare with many restrictions. 看到CommonsWare给出的这个好答案,但有很多限制。

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

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