问题描述
我正在开发一个 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-Version 您必须设置也应该导出哪些库/项目.
Since some ADT-Version you have to set which libraries / projects should be exported too.
Project-Propiertes -> Java Build Path -> Order and Export -> 检查您正在使用的源代码和其他库.
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.<YYY>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!