How to fix Class not found on Android from method XXX. on ADT

Bits Lovers
Written by Bits Lovers on
How to fix Class not found on Android from method XXX. on ADT

You’ll hit this error when spinning up an Android project with inline classes. Run it on an actual device and the runtime cant find a class that your code clearly has.

Here’s what it looks like:

Could not find class 'com.xxxnx.adt.Find$PlaceUnitListener', referenced from method com.xxxnx.adt.Find.<init>

And here’s a class structure that’ll trigger it:



package com.xxxnx.adt;

public class Find implements ApplicationListener {

    class PlaceUnitListener implements EventSubscriber {

        @Override
        public void onEvent(PlaceUnitEvent event)
        {
            //
        }
    }

    public Find() {

        EventBus.subscribe(PlaceUnitEvent.class, new PlaceUnitListener());
        EventBus.subscribe(RemoveScreenObjectEvent.class,
                new RemoveScreenObjectListener());
    }
}


Fixing the “Could not find class XXX referenced from method” error

The runtime cannot see your inner classes because the build path export is misconfigured.

In ADT:

Project → Properties → Java Build Path → Order and Export → Select your libraries.

Then clean and rebuild.

If you’re on Android Studio and stumbling across this in 2025, the situation is different. Studio does not use ADT anymore, but you might see something similar with ProGuard stripping inner classes, or with certain multidex configurations. The same root cause applies: something is not exporting properly at build time.

Bits Lovers

Bits Lovers

Professional writer and blogger. Focus on Cloud Computing.

Comments

comments powered by Disqus