如何在Android Studio的gradle build中启用--stacktrace或--info或--debug或--scan选项?

cgvd09ve  于 2023-06-06  发布在  Android
关注(0)|答案(2)|浏览(181)

我在Android Studio中遇到如下构建错误,如何在gradle build中启用--stacktrace或--info或--debug或--scan选项?

9:14:33 PM: Executing task 'build'...

Executing tasks: [build] in project C:\Users\rbeat\AndroidStudioProjects\NewMVVM\app

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:prepareLintJarForPublish UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:dataBindingExportBuildInfoDebug UP-TO-DATE
> Task :app:dataBindingExportFeaturePackageIdsDebug UP-TO-DATE
> Task :app:dataBindingMergeDependencyArtifactsDebug UP-TO-DATE
> Task :app:dataBindingMergeGenClassesDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:dataBindingGenBaseClassesDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dataBindingGenBaseClassesDebug'.
> couldn't make a guess for com.example.newmvvm.ListViewModel.listViewModel

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
11 actionable tasks: 1 executed, 10 up-to-date
9:14:34 PM: Task execution finished 'build'.
83qze16e

83qze16e1#

从命令行执行gradle构建

gradle build --stacktrace
shyt4zoc

shyt4zoc2#

大多数人使用Logger,这样用户就可以使用--info或--debug来增加详细信息。
--stacktrace和--full-stacktrace真正控制Gradle在构建结束时打印的输出类型。
所以你可以用

1. gradle build --stacktrace
2. gradle build --full-stacktrace

相关问题