1

I have finished up an Android app and I am attempting to sign it now in release mode. I have generated a keystore, and have updated my built properties to check the appropriate keystore file and alias. Everything compiles just fine, and I am presented with a nice apk file. However, when I attempt to install this on a mobile device I receive a 'Unable to read AndroidManifest.xml' error. According to the Android docs, providing the keystore / alias via the build properties will automatically sign and align the final apk file.

If I rename the apk file to a zip, I can indeed see everything is there. I am unsure of what steps to take to solve this issue. I am doing everything command line, and not using Eclipse. If I install my app via debug release, it works just fine.

Here is the output of ant ([[PASSWORD]] is my password, and MYALIAS is my alias). 'CApp' is the primary activity.

> D:\Development\Projects\Dash>ant release Buildfile:
> D:\Development\Projects\Dash\build.xml
>     [setup] Android SDK Tools Revision 11
>     [setup] Project Target: Android 2.1-update1
>     [setup] API level: 7
>     [setup]
>     [setup] ------------------
>     [setup] Resolving library dependencies:
>     [setup] No library dependencies.
>     [setup]
>     [setup] ------------------
>     [setup]
>     [setup]
>     [setup] Importing rules file: tools\ant\main_rules.xml
> 
> -set-release-mode:
>      [echo] *************************************************
>      [echo] ****  Android Manifest has debuggable=true   ****
>      [echo] **** Doing DEBUG packaging with RELEASE keys ****
>      [echo] *************************************************
> 
> -release-obfuscation-check:
> 
> -pre-build:
> 
> -dirs:
>      [echo] Creating output directories if needed...
>     [mkdir] Created dir: D:\Development\Projects\Dash\bin
>     [mkdir] Created dir: D:\Development\Projects\Dash\gen
>     [mkdir] Created dir: D:\Development\Projects\Dash\bin\classes
> 
> -aidl:
>      [echo] Compiling aidl files into Java classes...
> 
> -renderscript:
>      [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
> 
> -resource-src:
>      [echo] Generating R.java / Manifest.java from the resources...
> 
> -pre-compile:
> 
> compile:
>     [javac] D:\Development\Libraries\android-sdk-windows\tools\ant\main_rules.xml:384:
> warning: 'includeantruntime' was not set, defaulting to
> build.sysclasspat h=last; set to false for repeatable builds
>     [javac] Compiling 14 source files to D:\Development\Projects\Dash\bin\classes
> 
> -post-compile:
> 
> -obfuscate:
> 
> -dex:
>      [echo] Converting compiled files and external libraries into D:\Development\Projects\Dash\bin\classes.dex...
> 
> -package-resources:
>      [echo] Packaging resources
>      [aapt] Creating full resource package...  [aapt.exe] Warning: AndroidManifest.xml already defines debuggable (in
> http://schemas.android.com/apk/res/android); using existing value in
> manifest.
> 
> -package-release: [apkbuilder] Creating CApp-unsigned.apk for release...
> 
> -release-prompt-for-password:
>     [input] Please enter keystore password (store:1.keystore): [[PASSWORD]]
>     [input] Please enter password for alias 'MYALIAS': [[PASSWORD]]
> 
> -release-nosign:
> 
> release:
>      [echo] Signing final apk...   [signjar] Signing JAR: D:\Development\Projects\Dash\bin\CApp-unsigned.apk to
> D:\Development\Projects\Dash\bin\CApp-unaligned.apk as MYALIAS
>      [echo] Running zip align on final apk...
>      [echo] Release Package: D:\Development\Projects\Dash\bin\CApp-release.apk
> 
> BUILD SUCCESSFUL Total time: 16 seconds
MetaCipher
  • 274
  • 2
  • 8
  • Do you use Eclipse ? The reason I'm asking is because it is very easy to do it through Eclipse. – Abhinav Manchanda Jul 11 '11 at 16:36
  • "I am doing everything command line, and not using Eclipse." If I have to, I'll try that -- but I am trying to avoid going that route. – MetaCipher Jul 11 '11 at 20:33
  • I noticed I had debug on. I took that off. It still does the same thing. I also tried to use Eclipse, which reports that everything exports OK. But I still get the same error. – MetaCipher Jul 11 '11 at 20:57
  • 1
    This is driving me nuts. I have lowered the SDK version, changed my keystore file like 4 times, used Eclipse. Everything outputs a perfectly good APK, but it refuses to install. I did notice this extra error in logcat: "Missed a central dir sig (at 0)" – MetaCipher Jul 11 '11 at 21:07
  • I managed to fix this. Apparently my FTP was uploading the file as ascii and not binary. – MetaCipher Jul 12 '11 at 16:37

0 Answers0