Android的导入库 [英] Android import library
问题描述
在我的项目,我需要使用外部库。该库由的.class
文件。 > Java构建路径 - - 我一直使用的属性添加的文件夹与此库到我的项目>库 - >添加类文件夹。我可以编译项目没有任何问题,但是当我运行它,我得到未能解决XY
并在那里创建类的实例,从导入文件行调试器停止。
In my project, I need to use external library. That library consists of .class
files. I have added folder with this library to my project using properties -> Java Build Path -> Libraries -> Add class folder. I can compile project without any problem, but when I run it, I get failed resolving xy
and debugger stops on line where I create instance of class from imported files.
我猜外部库我心不是使用链接到我的.apk文件。我该如何解决这个问题?我试图查看这个库中的排序和导出选项卡假设,将库导出我的申请。但它没有工作。
I guess the external library I use isnt linked to my .apk file. How can I fix this? I have tried to check this library on "Order and Export" tab assuming that, it will export the library with my application. But it didnt work.
我怎么能这个库链接到我的项目.apk文件?我是否需要以某种方式先在设备上安装这个库?我是否需要复制该库的应用程序文件夹?
How can I link this library to my project .apk? Do I need to somehow install this library on device first? Do I need to copy this library in application folder?
PS:我使用的Eclipse朱诺,Android SDK中的目标10
PS: I'm using Eclipse Juno, android SDK target 10.
感谢您
更新
我有这个库复制到库
文件夹。外部库路径是:
I have this library copied in libs
folder. External library path is:
my_project/libs/sk/aicit/leg/libraries*.class
我已经加入 ./库
文件夹中的库项目的设置。
我不要有的.jar
版本库中,只有的.class
文件。
I have added ./libs
folder in Libraries settings of project.
I do not have .jar
version of this library, only .class
files.
我也有烃源$ C $这个库的C,但我没有想包括它的类在我的项目,它有它自己的依赖,我想只是链接像图书馆。它的外部库我还没有写。
I have also souce code of this library, but I didnt want to include its classes in my project, it has its own dependencies, I wanted to just "link" it like library. Its an external library I havent written.
更新2
我抄从库中的所有源文件到我的项目的src /目录。我从Java构建路径中删除库。我可以STIL编译我的项目,但是当我运行它的iget
I have copied all the source files from library to my projects "src/" dir. I have removed Library from Java build path. I can stil compile my project, but when I run it Iget
FATAL EXCEPTION:main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{
com.example/myvideorecord/com.example.myvideorecord.Robot}: java.langNullPointerException
...
我能做些什么,如何调试这个错误? :(
What can I do, how to debug this error? :(
推荐答案
步骤
- 的库文件复制到libs文件夹
- 选择jar文件 - >右键 - >构建路径 - >添加到构建路径
- 清洁工程项目 - >清理 - >选择你的项目 - >确定
这篇关于Android的导入库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!