如何建立你的Gradle使用一个项目? [英] How you build a project using gradle?

查看:171
本文介绍了如何建立你的Gradle使用一个项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的build.gradle给出below.i发现了这个错误。

 错误:(15)发生问题的根源评估项目smartwisher。
>找不到根工程smartwisher的论点[build_3rvo44ss7197kfip29gkh81rb6 $ @ _run_closure2 1d7a1869]法的Andr​​oid()。

这是其中的build.gradle我在我的机器人工作室。

  //顶级构建文件,您可以添加常用的配置选项,所有分项目/模块。
    buildscript {
        库{
            mavenCentral()
        }
        依赖{
            类路径'com.android.tools.build:gradle:0.12.+
        }
    }
    allprojects {
        库{
            mavenCentral()
        }
    }
    安卓{
        compileSdkVersion 19
        buildToolsVersion '20 .0.0
        defaultConfig {}
        productFlavors {
        }
    }
    依赖{
    }


解决方案

您不能使用顶级 的build.gradle 来指定Android的配置。

您必须在您的模块/的build.gradle文件移动了android块。

您的文件夹。

 
  模
     的build.gradle
  的build.gradle
  settings.gradle

在您的顶层文件:

  buildscript {
    库{
        mavenCentral()
    }
    依赖{
        类路径'com.android.tools.build:gradle:0.12.+
    }
}
allprojects {
    库{
        mavenCentral()
    }
}

在您的模块/的build.gradle:

 应用插件:'机器人'安卓{}依赖{
}

My build.gradle is given below.i have found this error.

Error:(15) A problem occurred evaluating root project 'smartwisher'.
> Could not find method android() for arguments [build_3rvo44ss7197kfip29gkh81rb6$_run_closure2@1d7a1869] on root project 'smartwisher'. 

This is build.gradle which i have in my android studio.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.12.+'
        }
    }
    allprojects {
        repositories {
            mavenCentral()
        }
    }
    android {
        compileSdkVersion 19
        buildToolsVersion '20.0.0'
        defaultConfig {}
        productFlavors {
        }
    }
    dependencies {
    }

解决方案

You can't use the top level build.gradle to specify android configuration.

You have to move the android block in your module/build.gradle file.

Your folders.

root
  module
     build.gradle
  build.gradle
  settings.gradle

In your top-level file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
}

In your module/build.gradle:

apply plugin: 'android'

android {

}

dependencies {
}

这篇关于如何建立你的Gradle使用一个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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