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)

      

+3


source to share


8 answers


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

+2


source


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.

+5


source


Using the latest from https://github.com/JakeWharton/ActionBarSherlock build without issue on ADT 21.x

+2


source


This sometimes happens with an eclipse. I suggest that you always try the apk file on a real device before uploading it to the app store.

The issue is resolved by cleaning the project and then exporting it.

+1


source


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.** { *; }

      

+1


source


I believe eclipse launches zipalign for you, so you don't have to do it yourself. Maybe try this?

And yes, working with eclipse is in debug, proguard is being ignored. The export will be a release build and if a proguard is configured in project.properties it can take effect.

0


source


You may have zipaligned wrong, I don't believe eclipse will do it for you.

Correct syntax

zipalign -v 4 /location/to/eclipse/exported/apk /location/of/where/to/output/aligned/apk

      

0


source


Remove proguard optimizations. Don't use zipalign. Check the exported package. If it works - great, recheck zipalign / proguard options, if not - check something else)

0


source







All Articles