在项目创建时自动加载库。 Android,Eclipse

时间:2023-01-18 10:23:33

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

我已经想出如何在桌面上获得我想要的效果。

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

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

but i cant get the same effect on android.

但我无法在Android上获得相同的效果。

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

在桌面项目中,我可以看到文件夹“JRE Sysytem Library(jre7)”包含我引用的所有JAR

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"

这个目录在android项目中不存在。如何添加要自动包含在Android项目中的库,而无需使用“R-Click项目>属性> Java构建路径>库”方法或“R-Click JAR文件>构建路径>添加到构建路径” IDE中的方法“Eclipse”

5 个解决方案

#1


2  

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

在桌面项目中,我可以看到文件夹“JRE Sysytem Library(jre7)”包含我引用的所有JAR

An Android app does not use the JRE.

Android应用不使用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"

如何添加要自动包含在Android项目中的库,而无需使用“R-Click项目>属性> Java构建路径>库”方法或“R-Click JAR文件>构建路径>添加到构建路径” 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.

抱歉,这是不可能的。无论是手动还是自动填充,Android都不使用Eclipse的“添加外部JAR”。它仅在libs /或附加的Android库项目中使用JAR。

#2


2  

Eclipse doesn't provide this functionality, I believe.

我相信Eclipse不提供此功能。

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

另一方面,您可以选择配置构建路径,只需添加库。

#3


2  

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).

将jar放在android项目根文件夹的“libs”文件夹中。它们将从构建系统(ant / gradle)中使用和导出。

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

此链接将帮助您了解android项目中的每个文件夹可用于此处:

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

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

#4


1  

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.

另一种方法是设置一个Android库项目,其中包含项目的公共依赖项,因此您可以在Project-> Properties-> Android - Section中将此库项目添加为依赖项。

#5


1  

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)...

我正在使用libgdx创建我的应用程序,所以在查找并搜索eclipse在生成android项目时自动包含libs的方法后,我意识到答案很明显(但不容易做到)......

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...

我从github下载了libgdx源代码,学习了如何使用命令行git和ant,并按照他们的指示运行源代码。我现在让设置ui项目在源头工作。我开始尝试获取我在设置中使用的库...

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

我知道它可能,并将编辑这篇文章,提供有关我是否/如何设法实现这一崇高目标的信息

#1


2  

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

在桌面项目中,我可以看到文件夹“JRE Sysytem Library(jre7)”包含我引用的所有JAR

An Android app does not use the JRE.

Android应用不使用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"

如何添加要自动包含在Android项目中的库,而无需使用“R-Click项目>属性> Java构建路径>库”方法或“R-Click JAR文件>构建路径>添加到构建路径” 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.

抱歉,这是不可能的。无论是手动还是自动填充,Android都不使用Eclipse的“添加外部JAR”。它仅在libs /或附加的Android库项目中使用JAR。

#2


2  

Eclipse doesn't provide this functionality, I believe.

我相信Eclipse不提供此功能。

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

另一方面,您可以选择配置构建路径,只需添加库。

#3


2  

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).

将jar放在android项目根文件夹的“libs”文件夹中。它们将从构建系统(ant / gradle)中使用和导出。

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

此链接将帮助您了解android项目中的每个文件夹可用于此处:

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

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

#4


1  

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.

另一种方法是设置一个Android库项目,其中包含项目的公共依赖项,因此您可以在Project-> Properties-> Android - Section中将此库项目添加为依赖项。

#5


1  

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)...

我正在使用libgdx创建我的应用程序,所以在查找并搜索eclipse在生成android项目时自动包含libs的方法后,我意识到答案很明显(但不容易做到)......

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...

我从github下载了libgdx源代码,学习了如何使用命令行git和ant,并按照他们的指示运行源代码。我现在让设置ui项目在源头工作。我开始尝试获取我在设置中使用的库...

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

我知道它可能,并将编辑这篇文章,提供有关我是否/如何设法实现这一崇高目标的信息