Automatically load libraries on project creating. Android, Eclipse

与世无争的帅哥 提交于 2019-12-24 02:12:05

问题


I have figured out how to obtain the effect i desire on the desktop.

(Window > Preferences > Java > Installed JREs > jre7 [Edit] > [Add External JARs])

but i cant get the same effect on android.

In the desktop project i can see the folder "JRE Sysytem Library(jre7)" contains all the JARs i referenced

This directory is not present in the android project. How do I add libraries to be automatically included in an Android project without needing to use the "R-Click Project > Properties > Java Build Path > Libraries" method OR the "R-Click JAR file > Build Path > Add to build path" method in the IDE "Eclipse"


回答1:


In the desktop project i can see the folder "JRE Sysytem Library(jre7)" contains all the JARs i referenced

An Android app does not use the JRE.

How do I add libraries to be automatically included in an Android project without needing to use the "R-Click Project > Properties > Java Build Path > Libraries" method OR the "R-Click JAR file > Build Path > Add to build path" method in the IDE "Eclipse"

That is not possible, sorry. Android does not use Eclipse's "Add External JARs" regardless of whether it is manually or automatically populated. It only uses JARs in libs/ or attached Android library projects.




回答2:


Eclipse doesn't provide this functionality, I believe.

You can on the other hand Select configure build path and just add the libraries.




回答3:


Put the jars in the "libs" folder in your android project root folder. They will be used and exported from the build system (ant/gradle).

This link will help let you know what each folder in an android project could be used for here:

http://developer.android.com/tools/projects/index.html#ApplicationProjects




回答4:


Another way would be to setup an Android Library Project which includes common dependencies of your projects, so you could add this library project as dependency in the Project->Properties->Android - Section.




回答5:


Since nobody gave me an answer to my question (although they all of you did provide useful info and i think you for that) I will post the solution i found (but have not yet implemented)

I am using libgdx to create my applications so after looking and searching for a way to have eclipse automatically include libs when generating an android project, i realized that the answer was obvious (but not easy to do)...

i downloaded the libgdx source from github, learned how to use command line git and ant, and followed their instructions to get the source running. i now have the setup ui project working out of source. and am beginning my day by trying to get the libs i use included in the setup...

i know its possible and will edit this post with information on if/how i managed to accomplish this lofty goal



来源:https://stackoverflow.com/questions/20861752/automatically-load-libraries-on-project-creating-android-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!