使用 Android Studio 如何获得签名、非调试和 zip 对齐的 APK? [英] Using Android Studio how do I get a signed, non-debug and zip aligned APK?

查看:24
本文介绍了使用 Android Studio 如何获得签名、非调试和 zip 对齐的 APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Android Studio 如何获得签名、非调试和 zip 对齐的 APK?

Using Android Studio how do I get a signed, non-debug and zip aligned APK?

到目前为止,我可以得到一个签名的,但它被拒绝了,因为它有调试功能.

So far I can get a signed one but it gets rejected because it has debugging in it.

我可以得到一个非调试版本的 apk,但它被拒绝了,因为它不是 zip 对齐的.

I can get a non debug release apk but it gets rejected because it's not zip aligned.

我可以将其压缩对齐,但由于未签名而无法上传.

I can zip align it but then I can't upload it because that one is not signed.

我应该提到我在 Windows 上.我看过的大部分内容都是基于 linux 的,很难将 linux 路径与配置路径分开.

I should mention that I'm on windows. Most everything I've looked at is linux based and difficult to separate linux paths from config paths.

Edit2:目前事情被搁置.我更新了 Android Studio 并杀死了所有东西,因为它带有 gradle 1.9 依赖项但没有正确安装 gradle 1.9.所以我想我会用 gradle 1.9 下载完整的安装程序,但下载链接给了我我开始使用的版本.我知道.我应该知道比更新更好,但考虑到问题,我认为它实际上可能包含修复程序.

Things are on hold at the moment. I updated Android Studio and that killed everything because it comes with gradle 1.9 dependancies but doesn't install gradle 1.9 properly. So I thought I'd download the full installer with gradle 1.9 but the download link gives me the version I started with. I know. I should have known better than to update but given the issues I thought it might actually contain a fix.

Edit3:问题已解决.我已经输入了完整的答案准备发布,但我不会让我在明天之前发布它.

Problem solved. I have a full answer typed up ready to post but SO won't let me post it until tomorrow.

推荐答案

可以使用任何现有的 Android Studio gradle 项目并从命令行构建/签署它,而无需编辑任何文件.这使得将您的项目存储在版本控制中非常好,同时将您的密钥和密码分开,而不是在您的 build.gradle 文件中:

It is possible to take any existing Android Studio gradle project and build/sign it from the command line without editing any files. This makes it very nice for storing your project in version control while keeping your keys and passwords separate and not in your build.gradle file:

./gradlew assembleRelease -Pandroid.injected.signing.store.file=$KEYFILE -Pandroid.injected.signing.store.password=$STORE_PASSWORD -Pandroid.injected.signing.key.alias=$KEY_ALIAS -Pandroid.injected.signing.key.password=$KEY_PASSWORD

这篇关于使用 Android Studio 如何获得签名、非调试和 zip 对齐的 APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆