java - ClassCastException : ApiVersionImpl cannot

我有 android + gradle 项目。当我尝试启动应用程序时出现以下异常:

'ClassCastException: com.android.build.gradle.internal.model.ApiVersionImpl 无法转换为 java.lang.Integer: com.android.build.gradle.internal.model.ApiVersionImpl 无法转换为 java .lang.Integer'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.1'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
    }
}

apply plugin: 'android'
apply plugin: 'android-apt'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile files('libs/android-support-v4.jar')
    compile 'org.androidannotations:androidannotations-api:3.0.1'
    apt 'org.androidannotations:androidannotations:3.0.1'
}

android {
    compileSdkVersion 15
    buildToolsVersion '19.1'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 15
    }

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

最佳答案

有bug report向谷歌开放。对于 Intellij 13.1.4,它仍然是失败的。

将构建工具版本回滚到 1.10.+ 会有所帮助。

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

我意识到 IDEA Intellij 14 EAP没有这个问题,也支持Android L。

关于java - ClassCastException : ApiVersionImpl cannot be cast to java. lang.Integer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24633529/

相关文章:

eclipse - 防止 eclipse 在运行 Ant 任务之前构建项目

angular - 找不到模块 "tslib"

ios - Jenkins - xcodebuild 连接对等方拒绝拒绝 dtxproxy :XCT

maven - 处理本地存储库中旧快照的最佳方法?

android - ADT Eclipse + Gradle : incomplete BuildC

ant - 没有 -q 标志让 Ant 安静?

c++ - 构建或编译

hibernate - 未能执行目标和 hibernate 无效 LOC header (错误签名)

delphi - 项目构建配置的上下文菜单中的 "Make"和 "Build"有什么区别?

jenkins - 如何从 Jenkins 2.0 管道脚本中读取属性文件