Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
298 views
in Technique[技术] by (71.8m points)

android - Could not find class XXX referenced from method XXX.<YYY>

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());
    }
}

Any ideas why on Android, at runtime it can't find that inline class?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since some ADT-Version you have to set which libraries / projects should be exported too.

Project-Propiertes -> Java Build Path -> Order and Export -> Check your Sources and other Libraries you are using.

Do these Export-Settings for your Core- and Android-Project.

Then it should work fine on Android.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...