2

I write a android app in Eclipse and use run command on my cellphone.

It's run success on my cellphone.

But I use [Android Tools -> Export Signed Application Package...] to export my app.

Then use [adb install] to install apk on my cellphone and run.

And I got the error message:

07-22 11:20:43.537: E/AndroidRuntime(20216): Caused by: java.lang.ClassNotFoundException: com.mytest.MyActivity in loader dalvik.system.PathClassLoader[/data/app/com.mytest-1.apk]

In [Java Build Path -> Order and Export], I have been selected all.

In AndroidManifest.xml, the application attribute doesn't have android:name.

I don't know how to solve this problem.

I'm success use Eclipse run on my cellphone, why run error when I export the app?

please help me, thanks!!

3
  • are you using progaurd? if yes disable and make a signed apk n try Jul 22, 2012 at 4:43
  • Thanks, I didn't use progaurd.
    – Tony
    Jul 22, 2012 at 5:09
  • 1
    Just wanted to get this in in case it helps others. I got this fixed for me by fixing my android project properties. Right click on your project -> Android tools -> fix project properties
    – user787239
    Apr 8, 2013 at 18:46

3 Answers 3

5

I had same issue, after 2 hours of research I managed to fix this problem by deleting "bin" and "gen" folders and rebuilding project.

1
  • where are these folders located?
    – wick.ed
    Jul 19, 2017 at 16:37
4

There seems to multiple reasons for this happening from what I have researched. Do you have a lib folder? if so change it to "libs".

Do you have proguard enabled? If so that may cause the problem. Also try unchecking the "Android #.#.#" and "Android Dependencies" in your Build Path, Order and Export.

Check out this thread which has a bunch of other possible solutions, a lot of them deal with setting the proper ActivityName in the manifest file. java.lang.ClassNotFoundException on working app

If those solutions still don't solve the problem try these threads.

Android: Unable to instantiate activity / ClassNotFoundException

ClassNotFoundException Android

1
  • Thanks for your help~~ I'm updating my SDK Tools(Rev. 20) and SDK Platform-tools(Rev. 12) and ADT, then solved.
    – Tony
    Jul 22, 2012 at 5:07
0

What I had to do is just re-do the building/exporting process with no modification to the code whatsoever. It worked for me, which I did was to export it two times. On my first export, the build APK has lower file size and the second export (with no any modification to the code/configuration) produced a slightly larger file size (about 200KB diff).

This bug in building is really costly, kills you in front of your manager, and should be really fixed by Android/Eclipse team. Kind of sucks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.