如何解决“在项目中找不到的" generateDebugSources"?错误? [英] How do I resolve a "'generateDebugSources' not found in project" error?

查看:166
本文介绍了如何解决“在项目中找不到的" generateDebugSources"?错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图向我的应用程序中添加一个依赖项,而我不小心修改了错误的build.gradle文件,现在我的应用程序不再能够正确构建.

I was trying to add a dependency to my application and I accidentally modified the wrong build.gradle file and now my application no longer builds correctly.

这是我的错误:

Error:FAILURE: Build failed with an exception.

* What went wrong:
Task 'generateDebugSources' not found in project ':app'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我试图在此处实施现有的代码,但最终失败了因为我是gradle系统的新手,所以可以在Android Studio中进行操作.

I was trying to implement the code that exists here, but I ended up breaking things in Android Studio because I am new to the gradle system.

我编辑的文件是.idea/gradle.xml和build.gradle,我将其包括在下面:

The files I edited were .idea/gradle.xml and build.gradle, which I am including below:

build.gradle:

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

gradle.xml:

gradle.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
        <option name="distributionType" value="DEFAULT_WRAPPED" />
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="modules">
          <set>
            <option value="$PROJECT_DIR$" />
            <option value="$PROJECT_DIR$/app" />
          </set>
        </option>
      </GradleProjectSettings>
    </option>
  </component>
</project>

我试图尽可能接近默认文件,但最终使问题变得更糟,我无法再构建项目了.

I was trying to get as close as the default files are, but ended up making the problem worse and I cannot build my project anymore.

此外,我使用的是Android Studio 1.1.0,它显示为最新更新.

Also, I am using Android Studio 1.1.0, which is shown to be the latest update.

在此先感谢您,如果我需要提供更多信息,请告诉我.

Thanks in advance, and if I need to provide more information, just let me know.

推荐答案

我已解决问题;我发现新项目没有gradle问题,所以我做了一个新项目,并转移了我所有的src代码文件,它又能正常工作.

I fixed my issue; I discovered that new projects didn't have the issue with the gradle, so I made a new project and transferred all my src code files and it works fine again.

这篇关于如何解决“在项目中找不到的" generateDebugSources"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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