Didn't find class on path: dexpathlist
Asked Answered
S

8

18

Seriously, i don't know what to do to solve this problem. My android project was working fine, until i needed to import a library with Maven. Since that, everything started to collapse.

What is happening: When i start my application, the following error appears on LogCat and android tells that my app stopped working. I've searched for this similar error here AND on the rest of the internet, but everything people did haven't worked for me.

Error:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.buscaserra/com.buscaserra.main.ActivitySplash}: java.lang.ClassNotFoundException: Didn't find class "com.buscaserra.main.ActivitySplash" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.buscaserra-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.buscaserra-2, /vendor/lib, /system/lib]]

Manifest and packages: manifest packages

Build Path: buildpath

Sagesagebrush answered 15/4, 2014 at 3:56 Comment(9)
Tried to disable maven nature, used android "fix project", made a project clean and the problem is still happening.Sagesagebrush
What does your pom look like?Beater
It is almost empty. The only library i have imported is from this website: https://github.com/koush/UrlImageViewHelper. Still, even disabling maven, the problem is happening.Sagesagebrush
Could help you get an answer if you posted your POM.Beater
Sorry, I'm not at home at the moment and i don't have access to my project... but my Pom looks like this: Create a new Pom, add the dependency of the library i stated above and that's it.Sagesagebrush
Depends what you mean by "library" - that can mean many things. Do you mean APKLIB? or a JAR? or AAR?Beater
were you able to fix this? i am having the same problem and i believe it has to do with the maps v1, but i am not certainScrip
Ariel, i had to create a new project and i've copied everything from this one to the new one. Problem solved.Sagesagebrush
This post here provided a solution, which fixed mine. #10866931Monolithic
D
6

Same problem here. What worked for me was adding android-support-v4.jar as a lib and making sure it was checked on Project properties -> Build Path -> Order & export. It was mentioned here

Deme answered 1/10, 2014 at 22:5 Comment(2)
How do I check? I've been looking for this in Android Studio forever. I can never find Properties to begin with.Calypso
This was really for the eclipse based IDE, but I suppose you can go to module settings and then look at the dependencies.Deme
B
2

I had the same problem when I moved the project folder from a Linux machine to a Mac.

What I did was:

  1. Close the project
  2. Remove the .iml file
  3. Import the project using the "Create new project using existing code"

I am using IntelliJ.

Cheers.

Buine answered 2/4, 2015 at 23:58 Comment(0)
B
2

I did the following steps to resolve the issue on Android Studio.

  • open file ./app/build.gradle
  • reduce compileSdkVersion (e.g. 22 -> 21)
  • click 'sync project with gradle file'
  • change back to the original compileSdkVersion (e.g. 22)
  • click 'sync project with gradle file'

recompile and it should work.

Barcelona answered 29/5, 2015 at 3:28 Comment(1)
I don't understand how changing sdk versions solves this dex problem...Nino
M
1

I have spent way to many hours on this stupid issue but finally got it resolved:

When creating a new project -> package name is causing this stupid dex issue to appear, must not be able to find the main activity during run time with whatever deployment assemply setup. Android Studio doesn't like some of my commonly used package names, I'm completely baffled..I think this is a pretty big bug haha

Given the following new project parameters:

Name: NotificationApp, packageName: com.stores.business.notificationapp, saveLocation: /home/me/AndroidStudioProjects/NotificationApp

I would get the following error: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.stores.business.notificationapp/com.stores.business.notificationapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.stores.business.notificationapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.stores.business.notificationapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.cvs.stores.myapplication-2/lib/arm64, /vendor/lib64, /system/lib64]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)

My Solution I resolved it by changing the package name to:com.notificationapp, then File->invalidate caches/Restart..hope this helps someone else haha

Magnolia answered 23/8, 2019 at 18:55 Comment(0)
B
0

Do you have any required projects on the build path? Can't tell from your screen shot but check your "Projects" tab. You may have inadvertently added a Project Library as a required project instead. Remove the project from the Projects tab and then project -> properties. Click Android, add the project as a library instead here...

Byzantium answered 24/9, 2014 at 16:0 Comment(0)
U
0

Make sure that any compatibility lib jars that you're using in your main project (like android-support-v4.jar) are the same versions as those used in any of the projects that your main project references.

I had this same problem and what solved it was to copy and paste the android-support-v4.jar from another library project (that my main project was referencing) and pasting it into my main project's /libs folder.

Unify answered 19/11, 2014 at 23:25 Comment(0)
P
0

I had the same issue. Nothing had changed except Android studio and Gradle updated since I last compiled.

I took a look at the build options under Build>Edit Build Types and noticed that the one option that was different between my project that didn't run and the ones that did work was the Minify Enable option.

I set it to false and now everything works again.

Perse answered 24/4, 2018 at 3:30 Comment(0)
B
-1

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: https://developer.android.com/studio/build/multidex.html

First add this to my gradle.build:

defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...

// Enabling multidex support.
multiDexEnabled true
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

Then I extend my Application class (or declare the application class in AndroidManifest.xml or override attachBaseContext() function) as instructed by the MultiDexApplication class document on the page. This have fixed my problem.

Byebye answered 30/5, 2016 at 13:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.