找不到从方法 XXX 引用的类 XXX.<YYY>

Could not find class XXX referenced from method XXX.lt;YYYgt;(找不到从方法 XXX 引用的类 XXX.lt;YYYgt;)
本文介绍了找不到从方法 XXX 引用的类 XXX.<YYY>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 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.&lt;YYY&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)