如何在android中压缩Align APK文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23333724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to zip Align APK file in android?
提问by Luckyy Nickey
I am uploading my first APK file to google play but I am getting following error.
我正在将我的第一个 APK 文件上传到 google play,但出现以下错误。
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again.
您上传的 APK 不是 zip 对齐的。您需要在 APK 上运行 zip align 工具并再次上传。
Can any one tell me how to zip align my apk file ?
谁能告诉我如何压缩对齐我的 apk 文件?
Please tell me steps for that ?
请告诉我步骤?
回答by A Nice Guy
Read the documentationfrom Google itself
阅读Google 本身的文档
The steps should be simple to follow.
这些步骤应该很容易遵循。
Please follow thisdoc from google for complete publishing details
请按照谷歌的此文档获取完整的发布详细信息
In short,complete steps in a nutshell(I am assuming you use eclipse/android sdk):
简而言之,完整的步骤(我假设您使用 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
回答by Jerry
If you use Eclipse export wizard, it will automatically align it for you. However you can do it manually yourself
如果您使用 Eclipse 导出向导,它会自动为您对齐。但是你可以自己手动完成
To align infile.apk and save it as outfile.apk:
对齐 infile.apk 并将其保存为 outfile.apk:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
This website can provide more answers :) http://developer.android.com/tools/help/zipalign.html
这个网站可以提供更多的答案:) http://developer.android.com/tools/help/zipalign.html
回答by duggu
try below link or code:-
尝试以下链接或代码:-
To align infile.apk and save it as outfile.apk:
对齐 infile.apk 并将其保存为 outfile.apk:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
To confirm the alignment of existing.apk:
确认 existing.apk 的对齐方式:
zipalign -c -v <alignment> existing.apk
The is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.
是定义字节对齐边界的整数。这必须始终为 4(提供 32 位对齐),否则它实际上什么也不做。
Flags:
标志:
-f : overwrite existing outfile.zip
-v : verbose output
-c : confirm the alignment of the given file
http://developer.android.com/tools/help/zipalign.html
http://developer.android.com/tools/help/zipalign.html
回答by Moshe
Check themanifest.xml
file in your project it should say something like this:
检查manifest.xml
项目中的文件,它应该是这样的:
android:debuggable="true"
set it to "false"
.
将其设置为"false"
.
回答by Jameson
If you use eclipse the easiest way is to do it directly from it.
如果您使用 eclipse,最简单的方法是直接从它进行操作。
Go to "File" -> "Export" -> "Android Application Export"
转到“文件”->“导出”->“Android 应用程序导出”
The tool would ask you if you already have a keystore, if you do use it if not create a new one and save it on a safe place (you must remember the password so be sure to keep it somewhere you cannot lose it).
该工具会询问您是否已经有一个密钥库,如果您确实使用它,如果没有创建一个新的并将其保存在安全的地方(您必须记住密码,因此请确保将其保存在不会丢失的地方)。
Then upload the file and there should be no errors.
然后上传文件,应该没有错误。
回答by becker
I had a similar issue and tried all of the hints that are listed here but not cigar, I thought it was a bug but all my other Apps would work is just one of them had the issue e.g. after passing the not zip align I'd get You uploaded a debuggable apk. I was generating the apk from Eclipse/Indigo and the problem was the last step where it specifies the apk path somehow was pointing to some subdirectory had no idea how that one got in there, but using the proper path took care of it.
我有一个类似的问题,并尝试了这里列出的所有提示但不是雪茄,我认为这是一个错误,但我所有其他应用程序都可以工作只是其中一个有问题,例如在通过了 not zip align 之后我会get 你上传了一个可调试的 apk。我正在从 Eclipse/Indigo 生成 apk,问题是最后一步,它指定 apk 路径以某种方式指向某个子目录,不知道那个子目录是如何进入那里的,但是使用正确的路径可以解决它。
回答by Teo Mihaila
Just make sure you upload the "app-release.apk" file. You find it at this location: Your_Project_Folder/app/app-release.apk
只要确保你上传了“app-release.apk”文件。您可以在以下位置找到它:Your_Project_Folder/app/app-release.apk