java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist

Karthik Sivam 08/21/2017. 13 answers, 93.384 views
java android android c++ android-ndk android-ndk

I'm currently working on a project in which I have to use purely native ndk. It worked when I try running an helloworld example from Irrlicht engine source. Then I try using it in my project following the same format of that example. But I got:

03-14 01:40:05.308: E/AndroidRuntime(799): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.irrlicht.example1/}: java.lang.ClassNotFoundException: Didn't find class "" on path: DexPathList[[zip file "/data/app/com.irrlicht.example1-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.irrlicht.example1-2, /system/lib]]

while running my project.

Here is my main.cpp file:

#include <android/log.h>
#include <jni.h>
#include <android_native_app_glue.h>
#include "android_tools.h"
void android_main(android_app* app)
__android_log_print(4 , "pom" , "nothing");



LOCAL_PATH := $(call my-dir)/..
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := /home/karthik/Android/Essentials/ogl-es/lib/Android/libIrrlicht.a
include $(CLEAR_VARS)
LOCAL_MODULE := HelloWorldMobile1
LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
LOCAL_C_INCLUDES := -I ../../include -I /home/karthik/Android/Essentials/ogl-es/include -I /home/karthik/Android/json/jsoncpp-src-0.5.0/libs/linux-gcc-4.8 -I /home/karthik/Android/json/jsoncpp-src-0.5.0/include/json 
LOCAL_SRC_FILES :=  android_tools.cpp main.cpp
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -ldl 
LOCAL_STATIC_LIBRARIES := Irrlicht android_native_app_glue
$(call import-module,android/native_app_glue)

And I have given Activity name in AndroidManifest.xml:

<manifest xmlns:android=""
<application android:icon="@drawable/irr_icon" android:label="HelloWorldMobile1" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:debuggable="true">
        <activity android:name=""
        <meta-data android:name="" android:value="HelloWorldMobile1" />                     

What is the mistake I am doing here? I'll post full code if necassary.

Siddharth_Vyas 03/14/2014
Are you using any external jar files?
Karthik Sivam 03/14/2014
@SiddharthVyas No , I'm not using external jar files in this.
1 Igor Ganapolsky 08/09/2016
Is your application multi-dexed? If so, then that explains the problem.
j2emanue 07/05/2017
when i did a signed apk this error did not happen. just debug

13 Answers

mnsalim 05/23/2017.

I had a similar problem, here's my solution:

  1. Right click on your project and select Properties.
  2. Select Java Build Path from the menu on the left.
  3. Select the Order and Export tab.
  4. From the list make sure the libraries or external jars you added to your project are checked.
  5. Finally, clean your project & run.

You may also check this answer.

1 FoxDonut 11/06/2016
This is the correct solution to the question. I have tested this with my libgdx game with the same errors found as the above. I found these errors by using the log generated with my phone (samsung galaxy S6). Once I applied this solution, all of my issues were solved.
2 Zin Min 03/25/2017
I cannot find Properties from right click of project. May be I am stupid. :(
2 user3036320 04/19/2017
please show the android studio solution...
2 Skyler 07/08/2017
I can't find properties either, anybody figure out how to navigate to the listed page

Sushil 03/14/2014.

This seems to be problem in your case. The relative path of your activity in manifest is not correct:

<activity android:name=""

replace this with :

<activity android:name=".POMActivity"


<activity android:name="com.irrlicht.example1.POMActivity"
1 Karthik Sivam 03/14/2014
I've tried both ,it shows the same exception.

Akash Bisariya 03/06/2017.

I should understand the problem by just seeing

dex errors

But it took half day to fix the issue.
I fix this by following android developers page's instruction:

First add this to file :

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21

    // Enabling multidex support.
    multiDexEnabled true

 dependencies {
     compile ''

Then extend Application class (or declare the application class in AndroidManifest.xml or override attachBaseContext() function) with the MultiDexApplication class as instructed on the above link.

That's all and it solved the problem.

1 milosmns 08/30/2016
Adding multi-dex is useful only when you pass the reference count limit (56k), and it is very unstable and very unreliable prior to Lollipop. This should be used to fix problems as a last resort.
Akash Bisariya 08/30/2016
then what should be the solution according to you
milosmns 08/30/2016
I'm just saying that multi-dex causes more trouble than it helps, which is clearly stated on the developer website. I wouldn't be here looking for an answer if I had one, would I?
Akash Bisariya 08/30/2016
Ok thanks for the info , Please update here if you found a good solution , it would be a great help.

V. Kalyuzhnyu 07/07/2016.

The deletion of app on device and cleaning of project works for me

crazyjune 06/13/2014.
  1. delete the bin folder
  2. change the order of librarys
  3. clean and rebuild

worked for me.

Ali Gürelli 10/13/2016.

i solved it by using: ./gradlew --stop command in android studio terminal. After perform this command then clean and rebuild project.

Redman 01/05/2017.

For any one who is having multidex enable write this

inside build.gradle

apply plugin: ''

android {
 defaultConfig {
      multiDexEnabled true
 dexOptions {
        javaMaxHeapSize "4g"

dependencies {
    compile ''
    compile ''
    compile ''

write a class EnableMultiDex like below

import android.content.Context;

public class EnableMultiDex extends MultiDexApplication {
    private static EnableMultiDex enableMultiDex;
    public static Context context;

    public EnableMultiDex(){

    public static EnableMultiDex getEnableMultiDexApp() {
        return enableMultiDex;

    public void onCreate() {
        context = getApplicationContext();


and in AndroidManifest.xml write this className inside Application tag


Ashik Abbas 07/26/2017.

I tried all possible options but result is zero. Finally i found correct solution which is helpful for me. Just go to disable Instant Run Go to File -> Settings -> Build,Execution, Deployment -> Instant Run -> Uncheck the checkbox for instant run. Run your app once and this apk file work properly..

Walking Code 05/05/2014.

Just Change your folder name from lib to libs ,

Then you will see some error marks in your project, to resolve this rightClick on project >

Properties > Java Build Path > libraries :

Remove all the library with red marks on it, then apply > ok > after that clean your project . TADA see the magic :)

Shubham 10/27/2015
folder name is libs only

Tere Bentikh 09/29/2015.

after i tried the given answers, i found out another reason for the same Exception, that i had to add the library i'm using manually to my main library through

Right click on my main library > 
Properties > 
Android > 
Go to the very bottom of the screen and click (Add) > 
Select my other library that caused the crash >

before this solution, i used the "Fix Project setup" from within the .java file in eclipse, but this did not work, so i had to add it manually here and it worked

dees91 11/21/2016.

If you receive this error after removing some gradle dependency, check your manifest and make sure that you removed all entries corresponding that dependency.

Petter Friberg 11/21/2016
Please don't add the same answer to multiple questions. Answer the best one and flag the rest as duplicates. See Is it acceptable to add a duplicate answer to several questions?

When you are using multidex , then try to extend your application class with MultiDexAppication instead of Application and override below method this required for Android below 5.0 (because 5.0 and above support to the multidex)

protected void attachBaseContext(Context base)

and in dependencies add this

compile ''

Shivegeeky 06/23/2017.

As per my understading i get the issue after update android studio 2.1 to 2.3 due to the instant feature my application will not run when i copy the apk from output and put into the sdcard. For this problem i build the apk from build option do build apk in android studio.

Related questions

Hot questions


Popular Tags