将 jars 添加到类路径、Eclipse、Android

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7432744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:59:41  来源:igfitidea点击:

Adding jars to classpath, Eclipse, Android

androideclipsejarclasspath

提问by k9b

Currently, I go to properties-> build path-> libraries -> and then add external jars to my classpath, I know this is the correct way to do this, for java at least. However, the issue is I am running it on the Android SDK 2.1. When I run the program, I do not think the android emulator can "find" the .jars in the classpath. Is this possible? If so, which folder do I put the jars before adding them to my classpath?

目前,我转到属性-> 构建路径-> 库-> 然后将外部 jar 添加到我的类路径中,我知道这是执行此操作的正确方法,至少对于 java。但是,问题是我在 Android SDK 2.1 上运行它。当我运行程序时,我认为 android 模拟器无法“找到”类路径中的 .jars。这可能吗?如果是这样,在将 jars 添加到我的类路径之前,我应该将它们放在哪个文件夹中?

回答by Matt

You can try doing it in eclipse by

您可以尝试在 eclipse 中通过

Right Click the jar --> Build Path --> Add to build path

回答by Alex Spencer

1) Go to your Finder / Explorer and select your .jar files 2) Drag your .jar files into Eclipse, (make sure to put them in your desired Project) 3) right click on each jar -> "build path" -> "add to build path"

1) 转到您的 Finder / Explorer 并选择您的 .jar 文件 2) 将您的 .jar 文件拖入 Eclipse,(确保将它们放在您想要的项目中) 3)右键单击每个 jar ->“构建路径”-> “添加到构建路径”

回答by Astronaut

What is the output of the LogCat?

LogCat 的输出是什么?

if you are using native code in your projects you must include the so files in libs->armeabi folder. stuff like box2d, chipmunk, xml2, etc...

如果您在项目中使用本机代码,则必须在 libs->armeabi 文件夹中包含 so 文件。诸如 box2d、花栗鼠、xml2 等之类的东西...