Android ClassNotFound Exception

Today when I was working on my Android project, I ran into strange issue. When I start my app, it crashes with ClassNotFound exception. It was unable to found Main activity class.

I tried so many things like clean – rebuild, removing all the references and add them again, changing target APIs. But it was not working. App never started.

After doing failed attempt for almost half an hour, it came to my attention that src folder in project was a simple folder. There was no package sign on it and when I explore it, all my packages where turned into folders and sub folders and that was the issue. My src folder was not a sources folder and because of that it was unable to found a class.

So to solve this issue.  Right click on src folder Select Java Build Path – > Use as a source folder.

And that’s it all the folders and sub folders in the src folder turned into packages and application was working fine. Hope this helps you and save your time.

This entry was posted in Android, Android App, Java, Mobile, Mobile Application on by .

About Hiren Dave

Hiren Dave is a software engineer, blogger and consultant with over 9 years of professional experience. He writes code in number of languages. Hiren has a passion for developing web apps, mobile apps and writing books and blog articles about programming. He has a solid experience of startups as he manages products for few startups. He is also passionate about researching and learning new technologies and trends. He has also authored a book Instant Sencha Touch, published by Packt and creator of Video Course "Beginning Laravel" for Packt

Leave a Reply

Your email address will not be published. Required fields are marked *