Eclipse exported apk crashing
I need to publish my application, I ran the Eclipse export wizard and exported the signed apk with a self signed certificate, I also ran the zipalign tool. The problem is that when I install this package on the device and run it, it crashes directly, although I can run the app directly from eclipse without issue. Will it have to do with proguard configs or something else ?!
Update: The problem is with the proguard config file, this is the stack trace of the exception:
01-28 17:49:03.510: E/AndroidRuntime(14897): FATAL EXCEPTION: main
01-28 17:49:03.510: E/AndroidRuntime(14897): java.lang.ExceptionInInitializerError
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.actionbarsherlock.app.SherlockActivity.c(Unknown Source)
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.actionbarsherlock.app.SherlockActivity.onPostCreate(Unknown Source)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1115)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1950)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.os.Handler.dispatchMessage(Handler.java:99)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.os.Looper.loop(Looper.java:137)
01-28 17:49:03.510: E/AndroidRuntime(14897): at android.app.ActivityThread.main(ActivityThread.java:4511)
01-28 17:49:03.510: E/AndroidRuntime(14897): at java.lang.reflect.Method.invokeNative(Native Method)
01-28 17:49:03.510: E/AndroidRuntime(14897): at java.lang.reflect.Method.invoke(Method.java:511)
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
01-28 17:49:03.510: E/AndroidRuntime(14897): at dalvik.system.NativeStart.main(Native Method)
01-28 17:49:03.510: E/AndroidRuntime(14897): Caused by: java.lang.IllegalArgumentException: Class a is not annotated with @Implementation
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.actionbarsherlock.a.a(Unknown Source)
01-28 17:49:03.510: E/AndroidRuntime(14897): at com.actionbarsherlock.a.<clinit>(Unknown Source)
source to share
I solved this problem by adding -keep to actionbarsherlock and maintaining the class and interface libraries
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
and adding the appropriate libraries using the -libraryjars keyword
source to share
Sometimes Eclipse just shuts down. What you can do that usually helps:
- Clean up your projects
- Uncheck Eclipse Desktop Preferences
How you can exactly take step # 2 depends on your OS, but on a Mac it is:
- Go to your workspace
- Open .metadata (you will need to see hidden folders for this)
- Open .plugins
- Open org.eclipse.e4.workbench
- Remove workbench.xmi
This will clear your basic workplace settings, including your settings.
Try to package the app before re-configuring your seat settings. Usually works for me.
source to share
Using the latest from https://github.com/JakeWharton/ActionBarSherlock build without issue on ADT 21.x
source to share
when creating a signed apk, you need to exclude any external jar files and libraries as below
-libraryjars libs
# The official support library.
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
# Library JARs.
-keep class de.greenrobot.dao.** { *; }
-keep interface de.greenrobot.dao.** { *; }
-keep class org.joda.** { *; }
-keep interface org.joda.** { *; }
-keep class com.loopj.android.http.** { *; }
-keep interface com.loopj.android.http.** { *; }
# Library projects.
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keep class com.viewpagerindicator.** { *; }
-keep interface com.viewpagerindicator.** { *; }
source to share