如何在android中压缩Align APK文件?

时间:2014-04-28 06:11:35

标签: android google-play apk publishing zipalign

我正在将我的第一个APK文件上传到Google Play,但我收到了以下错误。

  

您上传了一个非zip对齐的APK。您需要在APK上运行拉链对齐工具并再次上传。

任何人都可以告诉我如何拉链对齐我的apk文件吗?

请告诉我这方面的步骤?

7 个答案:

答案 0 :(得分:13)

阅读Google自己的documentation

这些步骤应该很容易理解。

请按照谷歌的 this 文档获取完整的发布详情

简而言之,完整的步骤(我假设您使用的是eclipse / android sdk):

 1. Check android_manifest.xml and verify that android:debuggable  attribute is set to false in your manifest file            
 2. Check the android:versionCode and android:versionName attributes. 
    (if this is the first time you are uploading a apk,   
    ignore, else if it is a new version of existing apk, make sure these   
    values are larger than previous apk)
 3. Export unsigned application package from Eclipse
 4. Sign the application using release key certificate(not debug key certificate)
 5. Zip align the package
 6. Upload in google play

答案 1 :(得分:12)

如果您使用Eclipse导出向导,它将自动为您对齐。但是你可以自己手动完成

将infile.apk对齐并保存为outfile.apk:

zipalign [-f] [-v] <alignment> infile.apk outfile.apk

本网站可提供更多答案:) http://developer.android.com/tools/help/zipalign.html

答案 2 :(得分:8)

尝试以下链接或代码: -

将infile.apk对齐并保存为outfile.apk:

zipalign [-f] [-v] <alignment> infile.apk outfile.apk

确认existing.apk的对齐方式:

zipalign -c -v <alignment> existing.apk

是一个定义字节对齐边界的整数。这必须始终为4(提供32位对齐),否则它实际上什么都不做。

标志:

-f : overwrite existing outfile.zip
-v : verbose output
-c : confirm the alignment of the given file

http://loomsdk.com/forums/loom-with-loomscript/topics/uploading-apk-to-google-play-displays-error-not-zip-aligned

http://developer.android.com/tools/help/zipalign.html

http://www.youtube.com/watch?v=ReRCJgS-g9o

答案 3 :(得分:3)

检查项目中的manifest.xml文件,它应该是这样的:

android:debuggable="true"

将其设为"false"

答案 4 :(得分:2)

如果你使用eclipse,最简单的方法是直接从它做。

转到&#34;文件&#34; - &GT; &#34;出口&#34; - &GT; &#34; Android应用程序导出&#34;

Select Android Application Export

该工具会询问您是否已经拥有密钥库,如果您使用它,如果不创建新密钥库并将其保存在安全的地方(您必须记住密码,所以请务必将密码保存在您不能丢失的地方) )。

然后上传文件,应该没有错误。

答案 5 :(得分:0)

我有一个类似的问题并尝试了这里列出的所有提示但不是雪茄,我认为这是一个错误,但我的所有其他应用程序都可以工作只是其中一个有问题,例如通过不拉链对齐后,我得到你上传了一个可调试的apk。我正在从Eclipse / Indigo生成apk,问题是最后一步,它指定apk路径以某种方式指向某个子目录,不知道那个人是如何进入的,但使用正确的路径处理它。

答案 6 :(得分:-1)

请务必上传&#34; app-release.apk&#34;文件。您可以在以下位置找到它:Your_Project_Folder / app / app-release.apk

相关问题