Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SherlockActionBar: Export signed apk, then Eclipse crashes :(

Today I finished testing my new android app..

I use SherlockActionBar.

Import as an /library

My OS is Ubuntu 12.10 64bit..

I can build the .apk from Eclipse and the app runs on my Android 2.3.3(mobile) and my Android 4.0(tablet).

But when I try to: Android tools -> Export signed application package, then Eclipse crashes :(

I get this error:(before the Export/crash)

Invalid ZIP archive: /home/voidcode/Ubuntu One/workspace/JakeWharton-ActionBarSherlock-e5c2d1c/library/bin/library.jar

This is the error log I find in the Eclipse-folder after the crash: http://paste.ubuntu.com/1677938/

My AndroidManifest.xml look like this:

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="15" />

And my project.properties look like this:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-14
android.library.reference.1=../JakeWharton-ActionBarSherlock-e5c2d1c/library
like image 273
Voidcode Avatar asked Feb 18 '13 17:02

Voidcode


1 Answers

You may want to check a couple of things in your project.

  • Your project.properties file targets Android API14, but your manifest targets API15. These should be the same
  • Sherlock ActionBar only works on API7+. This may be your issue actually. Try changing android:minSdkVersion="4" to android:minSdkVersion="7"
    • Obviously this will not allow anything prior to Android 2.1, but you'll still target nearly 100% of the ecosystem.

If that doesn't work, I've had lots of trouble with this as well and the exporting packages solutions are fairly random.

My general solution is to disable the auto build, clean it and then manually build the library projects.

For example

  • Under the Project menu
  • Uncheck Build automatically
  • Then Project > Clean...
  • On this window, uncheck Start build immediately
  • Choose Clean all projects and click OK
  • Select your Sherlock ActionBar project
  • Do Project > Build project (NOT Build All).
    • This will build ONLY this one library
    • Do this for any library projects you have included.
  • Click Now, export your project as a signed APK.

That generally works for me and stops a lot of the unexplained export issues.

like image 69
Kirk Avatar answered Oct 04 '22 12:10

Kirk