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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM