kotlin.jvm.KotlinReflectionNotSupportedError:在运行时找不到Kotlin反射实现.确保您有kotlin-reflect.jar [英] kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar

查看:1027
本文介绍了kotlin.jvm.KotlinReflectionNotSupportedError:在运行时找不到Kotlin反射实现.确保您有kotlin-reflect.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译时出现上述错误.我的gradle文件如下:-

When I compile I got the above error. My gradle file as below : -

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

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0 rc2"

    defaultConfig {
        applicationId "package.name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 6
        versionName "2.0"
    }

    buildTypes {
        debug {
            minifyEnabled false
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:$support_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile "org.jetbrains.anko:anko-sdk15:$anko_version"
    compile "org.jetbrains.anko:anko-support-v4:$anko_version"
    compile "com.android.support:recyclerview-v7:$support_version"
}

buildscript {
    ext.kotlin_version = '1.0.1-2'
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    }
}
repositories {
    mavenCentral()
}

我的项目如下所示

buildscript {
    ext.support_version = '23.2.1'
    ext.kotlin_version = '1.0.1'
    ext.anko_version = '0.8.3'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-alpha3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我想念任何东西吗?

推荐答案

从错误中,我认为:

implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

dependencies中的

以及标准库中.

in your dependencies in addition to the standard library.

这篇关于kotlin.jvm.KotlinReflectionNotSupportedError:在运行时找不到Kotlin反射实现.确保您有kotlin-reflect.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆