我尝试编译使用另一个名为HoloGraphLibrary的库的Android项目。但是当我要编译时会发生以下错误:

插件太旧,请更新到最新版本,或将环境变量ANDROID_DAILY_OVERRIDE设置为“9e19705c8c53c2712ca27200bfa349e4757e2264”

错误:(1,1)评估项目':HoloGraphLibrary'时发生问题。



该错误的来源是:

apply plugin: 'com.android.library'

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    sourceSets {
        main {
            java.srcDirs = ['src']
            res.srcDirs = ['res']
            manifest.srcFile 'AndroidManifest.xml'
        }
    }
}

这是库的build.gradle。该应用程序的build.gradle如下所示:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId "XXXXXXXXXXX"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 2
        versionName '1.0.1'
    }
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {
    main {
        res.srcDirs = ['src/main/res', 'src/main/res/tut', 'src/main/res/tutorial']
        resources.srcDirs = ['src/main/resources', 'src/main/resources/te']
    }
}
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(":HoloGraphLibrary")
}

我只是看不到如何解决此问题。有什么提示吗?

谢谢

---------------编辑----------------

这是顶级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:2.1.0-beta1'

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

allprojects {
    repositories {
        jcenter()
    }
}

不幸的是,G.K.的建议不工作!

我什至尝试将ANDROID_DAILY_OVERRIDE变量设置为它所说的内容,但同样是同样的错误。

最佳答案

好吧,我只是通过替换来解决了这个问题

apply plugin: 'com.android.library'

及其过时的版本
apply plugin: 'android-library'

这似乎暂时可行,但我认为这不是最佳解决方案,因此我愿意接受更好的解决方案。

10-07 19:14
查看更多