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?
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.
In my case, everything worked fine until I installed the new updates for the SDK and Eclipse.
I got an error: "Could not find class..."
I found solution in another stackoverflow site.
I have a similar problem when using external jar (in my case openCSV). The reason I had a problem was due to a change in ADT 17 (or above). What I needed to do to resolve the problem was In Eclipse go to Properties -> Java build path -> Order and export. Mark my jar. Move jar to top of the list. The solution was found in the following page which reference to a very good article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With