简体   繁体   中英

Kryonet and android

I am trying to use Kryonet in an Android application, but when I try it on the Android virtual device, and even on my Android cell phone, I get this error:

-Could not find class 'com.esotericsoftware.kryonet.Client', referenced from method com.Boussole.phone.MainActivity.onCreate

I already added Kryonet to the build path:

properties/java build path --> Libraries-->add jars --> kryonet-2.18-all.jar 

If you are using Eclipse with ADT , the only thing you have to do when you want to add a jar library is to copy and paste it to the libs folder (this folder exists already under your Android project), and ADT will take care of adding it to the build path.

Actually you have no choice, if you add your jar file to the build path (the old way) it will compile correctly but it will give you that NoClassDefFoundException when launching your app.

(the answer was already mentionned in the succinct comment of njzk2)

I had to import the project into my eclipse workspace. via...

File > Import > Existing projects into workspace. This is for the top level of the project. (I'm assuming it has been downloaded from github?)

I did copy over the lib files into my Android projects lib folder.

I did get some errors but then ran eclipse as Administrator which solved every error. As the buildconfig failed to build in my Facebook SDK.

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