Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android signed app ClassNotFoundException

I have an app that works fine when deployed locally. I have signed it in eclipse, and the first time i did that it worked. I've made another build, and that works locally, but after i sign it, trying to open it on the phone immediately blows up with:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.MyAoo}: java.lang.ClassNotFoundException: com.myapp.MyAoo in loader dalvik.system.PathClassLoader[/data/app/com.myapp-1.apk

I've tried uninstalling and reinstalling. Same thing. Locally deployed, Unsigned app works. Signed app bombs. Any thoughts?

like image 918
Kevin Galligan Avatar asked Mar 02 '11 05:03

Kevin Galligan


3 Answers

Are you using proguard obfuscation? It will only kick in for signed jars, and will remove classes it deems "unused".

Try turning it off and re-sign and then try again.

To disable make sure that the file: /default.properties does not contain proguard.config property.

see http://developer.android.com/guide/developing/tools/proguard.html for more

like image 105
Guy Avatar answered Oct 13 '22 20:10

Guy


This turned out to be some weird setting somewhere. I still haven't really "figured it out". I was using eclipse to export the signed package, but I actually develop with intellij idea. I exported from idea, and it all worked fine.

like image 38
Kevin Galligan Avatar answered Oct 13 '22 20:10

Kevin Galligan


I had the exact same problem and it baffled me because I had previously signed and exported the apk on numerous occasions without problem. After disabling ProGuard to make sure it was not the cause, I cleaned the project in Eclipse:

From the top menu - click 'Project', click 'Clean' on the drop down menu that appears, select the project(s) to clean and click 'OK'.

After doing that, I was able to run the signed and exported apk without it crashing on startup.

like image 45
drewhemm Avatar answered Oct 13 '22 19:10

drewhemm