简体   繁体   中英

Howto use FTPClient JAR library with Android/Eclipse

While eagerly awaiting an answer to my simple-way FTP question, I'm trying to use the FTPClient library (http://androiddev.orkitra.com/?p=139), but I'm getting a "NoClassDefFoundError" exception, probably because I've done something wrong with the.JAR library file. I tried following the various pieces of help I've found, but still get the error.

I downloaded the JAR file, then in Eclipse I created a NEW folder in the.../myproj/libs area then imported the JAR: org.apache.commons.net_2.0.0.v200905272248.jar (note you MUST create the folder from Eclipse | File | New...)

I created a User Library (Window | Preferences | Java | Build Path | User Libraries), called it ClientFTP

I did an "Add Jar", browsed to the.../myproj/libs area, pointed to the.jar file

I went to Project | Properties | Java Build Path | Libraries and selected ClientFTP, then Add Jar of the JAR file

So now the file appears in my Package Explorer screen, and I can do:
import org.apache.commons.net.ftp.FTPClient;
and get no error in Eclipse when I instantiate the class so that part seems to work.

But when I run it on the Emulator, I get the exception. Does some magical incantation need to be placed in my AndroidManfest file? I can't think of what else it might be.
Thanks!

I finally got this figured out, Android has to do it the hard way, see the answer at: Howto do a simple ftp get file on Android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM