Android Studio 和 Gradle 构建错误 [英] Android Studio and Gradle build error

查看:35
本文介绍了Android Studio 和 Gradle 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 android studio 的新预览版并且非常喜欢它.但最近我的项目不会建立.我收到以下错误:

I've been using the new preview of android studio and really like it. But recently my project won't build. I get the following error:

Gradle: 
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':TestProj:compileDebug'.
> Compilation failed; see the compiler error output for details.

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

Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

问题是如何启用堆栈跟踪,以便找到错误的根源.事实上,我真的不知道是什么原因造成的.

Question is how do I enable the stack trace so I can get to the root of the error. As it is I really have no idea what's causing this.

推荐答案

如果您使用的是 Gradle Wrapper(Android Studio 中的推荐选项),您可以通过从项目根文件夹中的命令行运行 gradlew compileDebug --stacktrace 来启用堆栈跟踪(其中 gradlew 文件是).

If you are using the Gradle Wrapper (the recommended option in Android Studio), you enable stacktrace by running gradlew compileDebug --stacktrace from the command line in the root folder of your project (where the gradlew file is).

如果您不使用 gradle 包装器,则使用 gradle compileDebug --stacktrace 代替(大概).

If you are not using the gradle wrapper, you use gradle compileDebug --stacktrace instead (presumably).

您实际上并不需要使用 --stacktrace 运行,从命令行单独运行 gradlew compileDebug 应该会告诉您错误在哪里.

You don't really need to run with --stacktrace though, running gradlew compileDebug by itself, from the command line, should tell you where the error is.

我基于此评论提供此信息:

I based this information on this comment:

Android Studio 新建项目无法运行,抛出错误

这篇关于Android Studio 和 Gradle 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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