简体   繁体   English

使用其他第三方库的Android库项目

[英]Android library project using other 3rd party libraries

I have a library android project "Library" (with activities and all) and a normal android project "App" that uses the "Library" from source code. 我有一个库android项目“ Library”(包含活动和所有内容)和一个普通的android项目“ App”,该项目使用源代码中的“ Library”。 Library is not compiled seperatly. 库不是单独编译的。

Everything works just fine. 一切正常。 The problem is using 3rd party compiled jars "External Jars". 问题是使用第三方编译的罐子“外部罐子”。 My "Library" is using all the "External Jars". 我的“图书馆”正在使用所有“外部罐子”。 "App" can access only the "Library". “应用程序”只能访问“库”。 "External Jars" are accessed only by the "Library". “外部罐子”只能由“库”访问。

The problem is that "App" needs to have all the "External Jars" in its build path for the app to function properly. 问题是“ App”需要在其构建路径中具有所有“ External Jars”,才能使该应用正常运行。 What is that neccessery? 那是什么必需品? "App" doesn't call directly any of the "External Jars". “应用程序”不会直接调用任何“外部罐子”。

So i have included the Jars to the "App" AND the "Library". 因此,我已将Jars包含在“应用程序”和“库”中。 Is there any way that "App" don't have to have the "Jars" in it's build path? 有什么方法可以使“ App”的构建路径中不必包含“ Jars”?

I ask this because i worry about additional application size and because i can't get proguard to work that way. 我之所以这样问,是因为我担心额外的应用程序大小,而且因为我无法让proguard那样工作。

External library projects that you depend on should include their libraries in their libs directory. 您依赖的外部库项目应在其libs目录中包括其库。 The android build process will take care of bringing these in from the library as part of the building of your apk. android构建过程将负责将这些从库中引入,作为apk构建的一部分。 This sometimes causes issues in eclipse so, even though you have to have eclipse add these jars to "referenced libraries" or the project build path, when you generate the apk, if the library is an android library and its dependencies are in libs, you shouldn't need to do anything special. 有时这会导致eclipse问题,因此,即使您必须让eclipse将这些jar添加到“引用的库”或项目构建路径中,当生成apk时,如果该库是android库并且其依赖项在libs中,您不需要做任何特别的事情。

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

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