简体   繁体   English

Gradle无法编译.aar文件

[英]Gradle cannot compile .aar file

I'm trying to add an external library. 我正在尝试添加外部库。 I've created in a/libs folder under project folder and have the following code in my gradle.build file. 我在项目文件夹下的/ libs文件夹中创建,并在gradle.build文件中包含以下代码。 But it doesn't sync at all. 但它根本不同步。

// 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.9.+'
    }  
}

allprojects {
    repositories {
    mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}

dependencies {
    compile 'com.radiusnetworks:AndroidIBeaconLibrary:0.7.1@aar'
}

The error I'm getting is: Gradle 'BLE_Client' project refresh failed: Build script error, unsupported Gradle DSL method found: 'compile()'! 我得到的错误是:Gradle'BLE_Client'项目刷新失败:构建脚本错误,找不到支持的Gradle DSL方法:'compile()'! Possible causes could be: 可能的原因可能是:
- you are using Gradle version where the method is absent - you didn't apply Gradle plugin which provides the method - or there is a mistake in a build script - 您正在使用Gradle版本,其中方法不存在 - 您没有应用提供方法的Gradle插件 - 或者构建脚本中存在错误

You shouldn't add this dependency to the root-level build.gradle file. 您不应将此依赖项添加到根级build.gradle文件中。 Add it to your module's build.gradle file instead. 将其添加到模块的build.gradle文件中。 The top-level build file is for things that are common to all modules in your project, but it's highly unlikely that you'd want all modules to have the same dependencies, or even to share this one. 顶级构建文件适用于项目中所有模块通用的内容,但您不太可能希望所有模块具有相同的依赖关系,甚至不希望共享此模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM