i had this issue in intellij idea. this is how i solved it:

project properties > facets > click the android facet created from the external library you are adding > check the box 'library module'.


i had this issue, raised by several causes, but i see this in your stacktrace "**unable to instantiate activity componentinfo{...}: java.lang.classnotfoundexception: didn't find class "..." on path: dexpathlist[[**", i found a diference in my .classpath before it stop working.

 <?xml version="1.0" encoding="utf-8"?>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path=""/>
    <classpathentry kind="con" path=""/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="output" path="bin/classes"/>

i've added the line:

<classpathentry exported="true" kind="con" path=""/>

this is the final version:

  <?xml version="1.0" encoding="utf-8"?>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path=""/>
    <classpathentry kind="con" path=""/>
    <classpathentry exported="true" kind="con" path=""/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="output" path="bin/classes"/>

now it works! =)


i had the same exact issue. as @weiweia suggested, move the code from the java directory to src worked for me. i also removed the android dependencies from project --> properties --> java build path --> order and export, and made sure only to include library projects in the android screen.


i had this problem for quite a while, and like everybody else the answers above didn't apply to my project.

in my project i had linked up a project to my project and it was throwing classdefnotfounderror every time some code for the other project was executed.

so this was my solution. i went to project properties of my project and java build path. pressed the "source"-tab and "link source" from src-folder of the other project to my own project and named a new folder "core-src".

hopes this solution helps someone


i had the same issue. i am using

the problem in my case was that i changed the versioncode and versionname.

i had no problem when i had them set like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package="" android:versioncode="1" android:versionname="1.0" android:installlocation="auto">

the issue appeared when i changed it to this (versioncode 2 and versionname 0.0.1):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package=" " android:versioncode="2" android:versionname="0.0.1" android:installlocation="auto">

i fixed the issue by changing to versioncode 2 and versionname, like so:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" package=" " android:versioncode="2" android:versionname="" android:installlocation="auto">

i am unsure why this was a problem, maybe android doesn't like a lower versionname with a higher versioncode?

i found the following on

android:versioncode an internal version number. this number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. this is not the version number shown to users; that number is set by the versionname attribute. the value must be set as an integer, such as "100". you can define it however you want, as long as each successive version has a higher number. for example, it could be a build number. or you could translate a version number in "x.y" format to an integer by encoding the "x" and "y" separately in the lower and upper 16 bits. or you could simply increase the number by one each time a new version is released.

android:versionname the version number shown to users. this attribute can be set as a raw string or as a reference to a string resource. the string has no other purpose than to be displayed to users. the versioncode attribute holds the significant version number used internally.


just in case anybody faces the same problem as me and no suggest answer here helps.

for me the cause was, that the android studio refactor is buggy. i moved an innerclass outside of a class, which was a view and therefore also had a xml, where the direct path was set. this path will not get refactored by studio! and no error will be thrown.

hope this helps anybody. cheers.


in our case we wanted to compile vagrant version and had same error. we fixed it by clean project and rebuild project in build menu


i just restarted the device and ran the app. it worked without any issues. hope this helps someone :)


i found this error in android studio when i tried do debug in a device with api 23, so i checked the android studio and i noticed that i didnt had instaled this api 23 version. after install, i solved the problem.


i also faced the same problem, we can solve this by doing some thing like

1- uninstall the app.

2- rebuild the project.

3- clean the project.

4- invalidate and restart the project from file -> invalidate and restart.


i ran into the same issue. i solved it by first deleting the build folder in your android project folder and the build folder in your app folder. then clean your project and build.


java.lang.runtimeexception: unable to instantiate application java.lang.classnotfoundexception: didn't find class "" on path: /data/app.apk(in android 4.3, 4.1)

unable to instantiate application java.lang.classnotfoundexception: below lollipop iam facing like this error)

to disable instant run, it will work fine follow the below steps to disable instant run in android studio 1. go to file settings--> build,execution,deployment -->instant run ---> uncheck "enable instant run"


i faced this problem when i tried to build and install my app to a android 8.1.0 (api 26)phone.

the only reason is that i added android:hascode="false" to the application tag in the manifest file. however, it worked on api 24 with the same code when i tried several months ago (strange?).

after removing that attribute, the problem disappears.


i was having the same issue today. and tried all the above solutions already given but nothing worked for me. then i spent sometime and i found out the reason. i thought it could save some other developers time i am sharing here as well. the problem was with wrong package name. i was using mvp architecture, and i kept my activities in view package. and i copied the main class from my other project. this was the catch. in the xml, main activity was referring to different package that was just outer side. the package was not including my view directory (mvp hierarchy level). then i checked back in manifest as well. the same problem i found there as well. so i provided full path(package name) of my activity(untill mvp' view directory/package there i kept my all activities). this solved my problem. hope that helps others as well.


i had a similar problem for android 4 phone, but worked for versions above this. i had added "multidexenabled=true" line to gradle script due to some reasons before. and now i deleted this line and it worked for both versions (android 4 and above). but i didn't understand why i added that line and how it works now.


i had this issue recently and i am using android studio 0.8.4

the problem was the fact that i decided to rename an xml menu layout file that was called main.xml.

right click on it and chose refactor --> rename. before renaming it, be sure uncheck "search in comments and strings" and pressed refactor.

because my file was originally named 'main', it renamed critical paths in the app.iml and build.gradle, mainly the java.srcdirs in the build.gradle, since the path is defined as 'src/main/java'.

i hope this helps anyone that may be experiencing this issue.


i had this problem after upgrading from version 18. after the upgrade i had the following: project build target was 5.01, targetsdkversion=21

but: build tools were still from android 4.3.1 (18) what i noticed was that those apps that were deriving their activities from actionbaractivity crashed with the above error those that did not still ran.

so the simple fix was to use the latest android sdk build tools 21.1.2 instead of only those of android sdk build tools 18, which seems somehow the default.

so the culprit seems the appcompat library, which i use for actionbar backward compability.

and a by the way: using the appcompat library i had to set/fix: $sdkinstalldir$\android\android-sdk\extras\android\support\v7\appcompat\ target=android-21 (which was recommended in some other useful post and which has a value of 19 by default))


i had this problem several times and often i didn't do something obviously wrong with dependencies.

it's always a good idea to check if this 'not found' class is present in the final apk. if it is, like it happened in my cases, the problem usually is:

it's not that given class is not found, but it cannot be loaded because its super class is missing.

check if class that you extend is available and then try to fix your build script or dependencies accordingly.


i had the same issue on windows. i had renamed the path to the project to something containing a space.

make sure the path to your project does not contain a space.


solution mentioned here --> multidex issue solution worked for me. below is what needs to be added to application context :

protected void attachbasecontext(context base) {


i met the same problem and i noticed the sample code was put under directory "java" instead of directory "src". after moving the code to src, the problem was solved.

also make sure the app directory is split into multiple folders. e.g. /main/com/site/appname/ not /main/

hope it works~


i faced the same problem and solved it by doing the following:

from the build menu select

1- clean project.

2- build apk.


i face the same problem , and after a lot of work and search , i figured out the solution : i just cleaned the project then build the apk. -build->clean project -build-> build apk(s) i hope it is useful.....


1) create libs folder under project root
2) copy and paste the jar file into it
3) configure the build path (add jar)
4) clean and run

cheers :-)


i faced this error once when i defined a class that extended a view but referred to this custom view in the layout file with the wrong name. instead of <com.example.customview/>, i had included <com.customview/> in the xml layout file.


believe me or not... i tried out almost each answer i had found here on stackoverflow. nothing would help, until i just restarted the machine. my android studio works on ubuntu 16.04 lts.


if you get this error while using the new instant run feature in android studio 2.0 and above then this is some kind of bug on their side.
to fix this you will have to stop your app manually on device/emulator if it's not stopped then from android studio select buildrebuild project.
then click the run button or shift+f10


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



if you are using multidex on android 4.4 and prior, your issue might be that your activity class is located in the second dex file and therefore not found by the android system.

to keep your activity class in the main dex file, see this page:

to find which classes are located in a dex file use android studio.

simply drag n drop your apk into android studio. you should be able to see your dex files in the apk explorer.

then select the dex file to see what classes are inside.

another alternative is dexdump:

you can check the content of your dex files contained in your apk by using the command dexdump which can be found in


for windows users see this tool i made to ease the process


in my case it was proguard minification process that removed some important classes from my production apk.

the solution was to edit the file and add the following:

-keep class com.someimportant3rdpartypackage.** { *; }


this happens if we change build path of the app, this can be in any case of adding or removing or changing libraries or .jar file. the best solution is to restart the eclipse.


if you are using eclipse try project -> clean


if you added a new library project as a module to your android project and you're using kotlin in your library do not forget to add

apply plugin: 'kotlin-android'

to top of your module's gradle file. android studio does not add this line when you created a new module and this may waste your hours like me.

edit: after a while, i just struggled with this problem again and this time i forgot to add my module as a dependency on the project. :)


i had same issue, this worked for me

1) full path of activity in mainfest in place of relative path.

2) delete 'build' folder and clean project.


for those of you who are having this issue on android studio, i had the same problem after a merge and for some reason it even persisted after clean and invalidate cash/restart operations which was driving me crazy.

turns out, it can be fixed by running gradle build once from command line. simply run the following n the project directory:

./gradlew assemble clean
./gradlew assemble

i hope it'd save someone the time waste and frustration i had to go through.


this following method worked for me

  • right click on your project and select properties
  • the "properties for " panel will open. from the menu on the left go to java build path -> order and export
  • from the list below uncheck the box next to "android dependencies"
  • finally clean your project and run


i had the same issue for my project. it happened due to the conflict in android support library version between my project and the library project that i added in my project. put the same version android support library in your project and library projects you included and clean build... everything will work...

Related Query

More Query from same tag