采用Android工作室我如何才能一签,非调试和zip对齐APK?工作室、Android、APK、zip

2023-09-04 04:24:48 作者:一个人也要好好过i

采用Android工作室我如何才能一签,非调试和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,但被拒绝,因为它不是压缩对齐。

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.

编辑:我要指出,我在窗户。大多数的一切,我已经看了是基于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:事情是搁置的时刻。我更新的Andr​​oid Studio和杀死一切,因为它带有摇篮1.9依赖关系,但不安装摇篮1.9正常。所以我想我应该下载完整安装程序与摇篮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:问题解决了。我有一个完整的答案打完了准备后,但SO不会让我张贴到明天。

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

推荐答案

所有构建签署,即使是调试的人(这是用调试密钥签名)。这是设置它签你的发布版本正确的关键只是早晚的问题。您可以设置签名配置通过项目结构对话框,或者您也可以编辑 build.gradle 文件手动,下面的Gradle Plugin用户指南

All builds are signed, even debug ones (which are signed with a debug key). It's just a matter of setting it up to sign your release builds with the correct key. You can set up a signing config via the Project Structure dialog, or you can edit the build.gradle file by hand, following the instructions in the Gradle Plugin User Guide

在构建文件设置,您可以生成命令行的发行APK用命令

Once your build file is set up, you can either generate the release APK from the command line with the command

./gradlew assembleRelease

在Linux或Mac或Windows:

on Linux or Mac, or on Windows:

gradlew.bat assembleRelease

在GUI中,您可以通过生成变体视图选择它生成的发行版本:

or in the GUI, you can generate the release build by choosing it from the Build Variants view:

建设APK,并使用向导在上面签名。

building the APK, and signing it using the wizard.