爪哇(安卓) - 类未发现异常 [英] Java (Android) - class not found exception

查看:131
本文介绍了爪哇(安卓) - 类未发现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一些简单的FTP的东西,在Android系统。研究一点点后,我决定去与 Apache的公网。下面是我采取的步骤,以得到它的Eclipse下工作。

I'm trying to do some simple FTP stuff in Android. After researching a little bit, I decided to go with the apache-commons-net. Here are the steps I took to get it working under Eclipse.

  1. 从这里下载的软件包并解压缩至本地。
  2. 在Eclipse中,添加这个新的图书馆,我去为(窗口>)preferences>的Java>构建路径>用户库,点击,名称它 Apache的公网添加JAR文件... 给它挑选的的.jar 的文件来在下载的。
  3. 对于每一个的的.jar 的,我加在源代码连接作为<一个href="http://www.java-forums.org/new-java/10601-how-make-apache-commons-stringutils-etc-work-eclipse.html"相对=nofollow>这里描述。
  4. 一旦做到这一点,我右键单击我的项目,然后选择属性> Java构建路径>库,点击添加库...>用户库>(下一步>)选择 Apache的公网>完成。该库,然后显示在靠的Andr​​oid 2.2 标签。
  1. Downloaded the package from here and unpacked it locally.
  2. In Eclipse, to add this new library, I go to (Window >) Preferences > Java > Build Path > User Libraries, click New, name it apache-commons-net, then Add JARs... to it by picking the .jar files that came in the download.
  3. For each .jar, I add in the Source attachment as described here.
  4. Once this is done, I right-click my project and choose Properties > Java Build Path > Libraries, click Add Library... > User Library > (Next >) choose apache-commons-net > Finish. The library then shows up alongside Android 2.2 in the Libraries tab.

我开始编程,和code完成正常工作的类/方法/等。从这个库。导入语句都包括在内,等一切都似乎工作,因为它应该。问题是,当我运行该应用程序,它强行关闭,我在Eclipse LogCat中显示了以下错误:

I start programming, and code completion works fine for the classes/methods/etc. from this library. Import statements are included, etc. Everything seems to work as it should. The problem is, when I run the app, it force closes and my LogCat in Eclipse shows the following error:

找不到类的org.apache.commons.net.ftp.FTPClient,从方法和其中引用; ...>
  ...
  java.lang.NoClassDefFoundError的:产生的原因org.apache.commons.net.ftp.FTPClient

Could not find class 'org.apache.commons.net.ftp.FTPClient', referenced from method <...>
...
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.net.ftp.FTPClient

好像我已经正确设置好一切,所以为什么在执行时报告说找不到类???

It seems like I've set everything up correctly, so why is the execution complaining that it can't find the class???

任何意见或帮助是极大的AP preciated。

Any ideas or help is greatly appreciated.

  • 伊恩

推荐答案

您需要的jar(S)复制到目录中的项目。该ADK从该文件夹挑选库,并将其转换成Dalvik的优化类。

You need to copy the jar(s) to the libs directory in the project. The ADK picks the libraries from that folder and convert them into classes optimized for Dalvik.

有可能是在这个问题上的一些信息:<一href="http://stackoverflow.com/questions/2694392/importing-external-jar-file-to-android-project">Importing外部.jar文件,Android项目

There might be some more information in this question: Importing external .jar file to Android project

这篇关于爪哇(安卓) - 类未发现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆