0

我正在将我的 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已更新

4

1 回答 1

1

请尝试检查您正在使用的变量,它们可能在某处被错误地投射。

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

即使可以在 Kotlin 中推断变量,也有一些可能的情况与您的情况不同。只是IDE没有显示它。

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

科特林问题

于 2015-11-27T11:08:08.167 回答