Gradle 命令之 --stacktrace , --info , --debug 用法

FAQ:

Android studio 出现错误Run with --stacktrace option to get the stack trace. Run with --info or --debu

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
19:09:16
我的电脑 2017/5/12 19:09:16
 

提示信息

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

其实是让你去查看更多的log信息。找到你项目的根目录,比如你的项目是MyApplication,在dos命令下进入该目录执行

gradlew compileDebug --stacktrace 

如果上面的命令不管用,可以使用下面的命令试试

gradle compileDebug --stacktrace 

可以看到很多错误的信息输出出来。


命令列表:
gradlew compileDebug --stacktrace  or
gradle compileDebug --stacktrace 
gradlew compileDebug --info
gradlew compileDebug --debug
 

常用的Gradle命令

下面介绍一些Gradle中常用的命令操作

  • 查看版本号: gradle -v
  • 编译执行某个task: gradle Task名
  • 静默编译执行某个task: gradle -q Task名(q表示quiet模式,表示编译执行Gradle脚本的过程中,只输出必要的信息. 除了quiet模式外,Gradle中还有其他三种模式)
  • 编译执行某个Project中的某个task:gradle -b Project名 Task名(Gradle默认只执行build.gradle文件中,自定义其他文件xxx.gradle编译运行显式指定Project名称,这里的build.gradle其实表示的就是build Project)
  • 显示所有的Project:gradle projects
  • 显示所有的task:gradle tasks
  • 显示gradle的gui:gradle --gui 或 gradle --gui&(后台运行)
  • 查找所有的gradle命令: gradle --help

##最后

此处只是一小部分gradle的基础使用总结,更多的gradle使用方式请戳这里Gradle User Guide

ref:

Chapter 4. Using the Gradle Command-Line
https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html

https://gradle.org/install

原文地址:https://www.cnblogs.com/bluestorm/p/6846950.html