Android的工作室:如何用摇篮产生签署APK?摇篮、如何用、工作室、Android

2023-09-04 08:19:29 作者:笔记.

我已经搜索在谷歌和SO但无法找到我的答案。

I've searched on Google and SO but cannot find my answer.

这是我第一次工作的摇篮系统,现在我在生成签名的APK点上传到谷歌播放(项目从日食进口)。

This is the first time I'm working with the gradle system and I am now at the point of generating a signed APK to upload to google play (Project is imported from eclipse).

现在我已经在这里http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks您应该添加 signingConfigs build.gradle

Now I've read the part here http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks that you should add signingConfigs to your build.gradle

我已经添加了这些行,现在我看见你需要运行 ./ gradlew assembleRelease 运行,但在我的CMD回报'摇篮'不被识别为内部或外部命令, 可运行的程序或批处理文件。我也试着右击build.gradle并运行它,说是SUCESSFUL但一旦我期待在build / APK文件夹只能称为文件应用程序调试-unaligned.apk

I've added these lines and now I saw that you need to run ./gradlew assembleRelease but running this in my cmd returns 'gradle' is not recognized as an internal or external command, operable program or batch file. I've also tried to right click on the build.gradle and run it, saying it was sucessful but once I look in the build/apk folder only a file called app-debug-unaligned.apk

那么,如何生成使用摇篮系统的签署APK?

So how do I generate the signed apk using the Gradle system?

推荐答案

有三种方法可生成构建具体根据 buildType 。 (在你的情况,它的发布,但它可以被命名为任何你想要的。)

There are three ways to generate your build as per the buildType. (In your case, it's release but it can be named anything you want.)

转到摇篮任务的机器人工作室的右侧面板并搜索 assembleRelease 组装(#y​​our_defined_buildtype)下的模块任务

转到变化范围左侧面板中,然后从下拉构建下来

Go to Build Variant in Left Panel and select the build from drop down

转到项目中的文件根目录下浏览和打开CMD /终端,运行:

Go to project root directory in File Explore and open cmd/terminal and run:

Linux的: ./ gradlew assembleRelease或组装(#y​​our_defined_buildtype)

视窗: gradlew assembleRelease或组装(#y​​our_defined_buildtype)

如果你想要做一个发布版本(只),你可以使用构建> 生成签名的apk 。对于其他版本的类型,只有上述三个选项可供选择。

If you want to do a release build (only), you can use Build > Generate Signed apk. For other build types, only the above three options are available.

您可以找到生成APK具有生成类型名称是您的模块/建目录。

You can find the generated APK in your module/build directory having the build type name in it.

 
精彩推荐
图片推荐