问题描述
我工作的一个libGDX项目,我有一类称为CheerVArachnids有这是一个事件监听其他内嵌类。当我在桌面上运行这个项目,它工作正常。但是当我运行我的Android设备上,它无法找到内联类,我得到了以下错误:
I'm working on a libGDX project and I have a class called CheerVArachnids that has another inline class which is an event listener. When I run this project on the desktop it works fine. BUT when I run on my Android device, it can't find that inline class and I get the following error:
Could not find class 'com.bbj.cva.CheerVArachnids$PlaceUnitListener', referenced from method com.bbj.cva.CheerVArachnids.<init>
下面是我班上的重要组成部分:
Here are the important parts of my class:
package com.bbj.cva;
public class CheerVArachnids implements ApplicationListener {
class PlaceUnitListener implements EventSubscriber<PlaceUnitEvent> {
@Override
public void onEvent(PlaceUnitEvent event)
{
//
}
}
public CheerVArachnids() {
EventBus.subscribe(PlaceUnitEvent.class, new PlaceUnitListener());
EventBus.subscribe(RemoveScreenObjectEvent.class,
new RemoveScreenObjectListener());
}
}
任何想法,为什么在Android上,在运行时就找不到内嵌类?
Any ideas why on Android, at runtime it can't find that inline class?
推荐答案
由于某些ADT-版本,你必须设置哪些库/项目应该被导出。
Since some ADT-Version you have to set which libraries / projects should be exported too.
项目-Propiertes - > Java构建路径 - >订单和出口 - >检查你的源代码和其他图书馆使用的是
Project-Propiertes -> Java Build Path -> Order and Export -> Check your Sources and other Libraries you are using.
做这些以出口设置你的核心 - 和Android项目。
Do these Export-Settings for your Core- and Android-Project.
然后,它应该能正常运行在Android上。
Then it should work fine on Android.
这篇关于找不到类从XXX XXX的方法引用&LT; YYY&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!