Error:Execution failed for task ':app:greendao'. Error:Execution failed for task ':app:greendao'. >

Error:Execution failed for task ':app:greendao'.
> org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(Ljava/lang/Object;)

Android Studio 的项目中build.gradle有两个,APP的build.gradle和项目工程的build.gradle. 出现上面的错误,是因为我们把配置全部写进了APP的build.gradle.

下面是正确的的配置
App的build.gradle:

apply plugin: 'org.greenrobot.greendao'
greendao {
    schemaVersion 1
    daoPackage 'com.example.myapplication.greendao.gen'
    targetGenDir 'src/main/java'
}

dependencies {
    compile 'org.greenrobot:greendao:3.2.0'
}

项目工程的build.gradle:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1'
    }
}

配置完毕后,Build–>Make Project 执行成功

你可能感兴趣的:(android)