简体   繁体   English

Android,引用其他库

[英]Android, referencing other libraries

Is there a way, how to add custom library to android app. 有没有一种方法,如何向Android应用程序添加自定义库。 If I add non-android library to my project it throws error "Only Android project can be add as dependency" and if I reference Android Library to Java Application it throws "This project cannot be added because it does not produce a JAR file using an Ant script." 如果我将非Android库添加到我的项目中,则会引发错误“只能将Android项目添加为依赖项”,如果我将Android库引用到Java应用程序中,则会抛出“该项目无法添加,因为它不会使用蚂蚁脚本。” the point is, that I want to keep code on one place (library) and reuse it. 关键是,我想将代码保存在一个地方(库)并重用它。

Your best bet is : 最好的选择是:

1.Create a folder called libs in your project's root folder
2.Copy your JAR files to the libs folder
3.Now right click on the Jar file and then select Build Path > Add to Build Path, which will create a folder called 'Referenced Libraries' within your project

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

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