Android gradle插件抱怨Uncaught翻译错误

时间:2015-11-21 07:58:35

标签: android android-gradle build.gradle kotlin kotlin-android-extensions

我正在将我的kotlin版本更新为1.0.0-beta-2423,我所做的就是更新相关依赖项的版本号。但是当我运行assembleDebug任务时,它会抱怨这个错误。

:app:transformClassesWithDexForDebug
Uncaught translation error: com.android.dx.cf.code.SimException: expected type java.lang.Object but found int
Uncaught translation error: com.android.dx.cf.code.SimException: expected type java.lang.Object but found int
2 errors; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

此处列出的所有依赖项:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.my.domain"
        minSdkVersion 18
        targetSdkVersion 23
        multiDexEnabled true
        versionCode 3
        versionName "0.0.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':hermes')
    compile project(':widget')
    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile "org.jetbrains.anko:anko-sdk23:$anko_version"
    compile "org.jetbrains.anko:anko-support-v4:$anko_version"
    apk "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-annotations:23.1.1'
    compile 'com.android.support:percent:23.1.1'
    compile 'io.reactivex:rxkotlin:0.30.1'
    compile 'io.reactivex:rxandroid:1.0.1'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'io.reactivex:rxjava-math:1.0.0'
    compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.6.3-4'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.google.android.gms:play-services-location:8.1.0'
    compile 'pl.charmas.android:android-reactive-location:0.8@aar'
    compile 'com.android.support:multidex:1.0.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'

}

buildscript {
    ext.kotlin_version = '1.0.0-beta-2423'
    ext.anko_version = '0.7.3'
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
repositories {
    mavenCentral()
}

这里出了什么问题?

更新 整个build.gradle是udpated

1 个答案:

答案 0 :(得分:1)

请尝试检查您正在使用的变量,它们可能在某处出错。

expected type java.lang.Object but found int,就是这个意思。

尽管可以在Kotlin中推断出变量,但有些情况可能与您的情况不同。只是IDE没有显示它。

我创建了一个问题,请查看它以获得更好的背景。

Kotlin Issue

相关问题