AndroidHow To's

Fix: java.lang.NoClassDefFoundError

The “java.lang.NoClassDefFoundError no apparent reason” is a pretty well-known error that can occur for one of two reasons. The first reason for which the “java.lang.NoClassDefFoundError no apparent reason” can occur is because of outdated Android Development Tools that need to be updated by the user. The more serious circumstances under which this error is known to occur is when a particular class (or the class on which a particular class relies on) that was available to the program during Compile Time cannot be found by the program at Run Time.

This issue is just as problematic as it is common, with most Java programmers wanting to fix the issue as soon as it arises. Well, the following are two fixes that have worked for Android Development Tools users who have suffered from the issue in the past:

METHOD 1: Clean the project

Backup the project which needs to be cleaned. While cleaning is generally pretty safe, prevention is always better than medication.

1. Navigate to the “Project” section in the toolbar.

2. Select “Clean” from the drop down menu.

3. In the window that opens subsequently, check “Clean projects selected below”.

4. Select the projects that need to be cleaned.

5. Click on “OK”.

NoClassDefFoundError1

METHOD 2: Check any unchecked libraries from the Build Path

Find the folder where the .jar libraries are located. This folder should be named “libs”. If the folder is named “lib” instead, right click on the folder, click on “Refactor” and then choose “Rename”.  Rename the folder to “libs”.

Right click on the project that is displaying the “java.lang.NoClassDefFoundError no apparent reason” error, choose “Build Path” and then select “Configure Build Path”.

Navigate to the “Order and Export” tab.

Check the boxes beside any .jar libraries (such as “gcm.jar” and “libGoogleAnalyticsV2.jar”) that are not already checked.

Clean the project again.

javalangnoclassdeffonderror2

Expert Tip

Fix: java.lang.NoClassDefFoundError

If the issue is with your Computer or a Laptop you should try using Reimage Plus which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Reimage by clicking the Download button below.

Download Now

I'm not interested

Close