建立通过命令行的Andr​​oid应用程序工作室 [英] Build Android Studio app via command line

查看:165
本文介绍了建立通过命令行的Andr​​oid应用程序工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Android应用工作室(的摇篮构建系统),但我想通过命令行来做到这一点。

I want to build an Android Studio app (the Gradle build system), but I want to do this via the command line.

我已经做了很多的搜索,并在此无法找到文档。

I have done a lot of search and cannot find documentation on this.

推荐答案

Android的工作室会自动创建一个包装摇篮在项目的根目录下这是怎么调用摇篮。该包装基本上是通过实际的摇篮二进制电话和让你保持摇篮更新,这使得使用版本控制更容易的脚本。要运行一个命令摇篮,你可以简单地使用项目的根(或 gradlew.bat gradlew 脚本>在Windows上),其次是要运行的任务的名称。例如,要建立自己的Andr​​oid应用程序的调试版本,你可以从你的资料库的根目录运行 ./ gradlew assembleDebug 。在默认的项目设置,所产生的apk然后可以在应用程序/生成/输出/ APK / APP-debug.apk 找到。在* nix的机器,你也可以运行找到。 -name'* .apk文件找到它,如果它不存在。

Android Studio automatically creates a Gradle wrapper in the root of your project, which is how it invokes Gradle. The wrapper is basically a script that calls through to the actual Gradle binary and allows you to keep Gradle up to date, which makes using version control easier. To run a Gradle command, you can simply use the gradlew script found in the root of your project (or gradlew.bat on Windows) followed by the name of the task you want to run. For instance, to build a debug version of your Android application, you can run ./gradlew assembleDebug from the root of your repository. In a default project setup, the resulting apk can then be found in app/build/outputs/apk/app-debug.apk. On a *nix machine, you can also just run find . -name '*.apk' to find it, if it's not there.

这篇关于建立通过命令行的Andr​​oid应用程序工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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