简体   繁体   English

Kryonet和android

[英]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: 我试图在Android应用程序中使用Kryonet,但是当我在Android虚拟设备上尝试它,甚至在我的Android手机上,我收到此错误:

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

I already added Kryonet to the build path: 我已经在构建路径中添加了Kryonet:

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. 如果您将Eclipse与ADT一起使用,那么当您想要添加jar库时,您唯一需要做的就是将其复制并粘贴到libs文件夹(此文件夹已存在于您的Android项目下),ADT将负责将其添加到构建路径。

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. 实际上你没有选择,如果你将你的jar文件添加到构建路径(旧的方式)它将正确编译但它会在启动你的应用程序时给你NoClassDefFoundException。

(the answer was already mentionned in the succinct comment of njzk2) (答案已在njzk2的简洁评论中提及)

I had to import the project into my eclipse workspace. 我不得不将项目导入我的eclipse工作区。 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?) (我假设它已经从github上下载了?)

I did copy over the lib files into my Android projects lib folder. 我把lib文件复制到我的Android项目lib文件夹中。

I did get some errors but then ran eclipse as Administrator which solved every error. 我确实得到了一些错误,但后来以管理员的身份运行了eclipse,解决了所有错误 As the buildconfig failed to build in my Facebook SDK. 由于buildconfig无法在我的Facebook SDK中构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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