Вопрос

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. 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()'! 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

Это было полезно?

Решение

You shouldn't add this dependency to the root-level build.gradle file. Add it to your module's build.gradle file instead. 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 с атрибуция
Не связан с StackOverflow
scroll top