无法找到方法Y引用类X [英] Could not find class X referenced from method Y
问题描述
我目前正试图编程一个Android应用程序。但我坚持,因为我想在结合我已经写了自己一个Java库。当我运行从普通的Eclipse测试code(没有Android设备)它完美的作品,但是当我尝试将其添加到我的Android code不会。
I'm currently trying to program an Android application. Yet I'm stuck because I'm trying in incorporate a Java library I've written myself. When I run a test code from a plain Eclipse (No Android) it works perfectly, but when I try to add it to my Android code it won't.
在我的库项目:
该项目是具有使用Java套接字服务器+客户端连接的项目,我已经写了服务器和客户端进行通信的API,在Windows中它完美的作品,但它不会加载我班:ClientAPI Android中:/
 我已出口我的code作为一个JAR文件。我查了一下:导出生成的类文件和放大器;资源。
结果
该项目还采用了来自LastFM等API外部库。
结果
结果
在我的Android项目:结果
我使用ADT v22.0.1-685705结果
采用的是Android 4.2.2参考库结果
 我复制我的图书馆到libs文件夹,我加载库在我的构建路径,并把它添加到顶部我的排序和导出名单
In my library project:
This project is a project that has a server + client connection using Java Sockets, I have written an API for the Server and Client to communicate, in Windows it works perfectly, yet it won't load my class: ClientAPI in Android :/
I have exported my code as a JAR File. I checked the: Export generated class files & resources.
This project also incorporates an external library from LastFM api.
In my Android project:
I'm using ADT v22.0.1-685705
Using the Android 4.2.2 reference library
I copied my library to the libs folder, I loaded the library in my build path and added it to the top my "Order and Export" list.
我曾尝试包括图书馆,但没有运气的几个排列。结果
我想:
I have tried several permutations of including the library but without luck.
I tried:
- 添加我的图书馆库文件夹+构建路径
- 我的图书馆+的LastFM等库添加到库文件夹+构建路径
- 导出我的图书馆作为一个可运行的jar +与罐子 上面两个步骤
- 项目复制到同一个工作区,包括该项目,而不是库
- 上面的步骤,但添加LastFM等库seperatly
- Add my library to 'libs' folder + build path
- Add my library + the LastFM library to 'libs' folder + build path
- Export my library as a runnable jar + the two above steps with that jar
- Copy the project to the same workspace and include the project instead of the library
- Above step but add the LastFM library seperatly
以上的尝试没有工作:/
我希望在Java套接字不让它不兼容的,因为这是我的计划是必不可少的。
None of the above tries worked :/ I hope the java socket doesn't make it incompatible because it is essential to my program.
推荐答案
使用JDK 1.7,而JDK 1.6是官方支持JDK项目:的 http://developer.android.com/sdk/index.html (参见系统要求)。虽然一些开发商使用JDK 1.7没有问题,这种情况下证明,这样做不来有一定的风险。
The project used JDK 1.7 while JDK 1.6 is the officially supported JDK: http://developer.android.com/sdk/index.html (see system requirements). While some developers use JDK 1.7 without problems, this case proves that doing so does come with certain risks.
这篇关于无法找到方法Y引用类X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!