我已经完成了Android应用,我正试图在发布模式下签名。我已经生成了一个密钥库,并更新了我的构建属性以检查相应的密钥库文件和别名。一切编译得很好,我提供了一个很好的apk文件。但是,当我尝试在移动设备上安装它时,我收到“无法读取AndroidManifest.xml”错误。根据Android文档,通过构建属性提供密钥库/别名将自动签名并对齐最终的apk文件。
如果我将apk文件重命名为zip文件,我确实可以看到一切都在那里。我不确定采取什么措施来解决这个问题。我正在做一切命令行,而不是使用Eclipse。如果我通过调试版本安装我的应用程序,它可以正常工作。
这是ant的输出([[PASSWORD]]是我的密码,MYALIAS是我的别名)。 'CApp'是主要活动。
> 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