Gradle sync失败:尝试访问方法kotlin.collections.ArraysKt ___ ArraysKt.copyOfRange

问题描述 投票:1回答:2

安装了最新版本的Android Studio(v3.3.2),并在尝试构建项目时发生以下错误。

Gradle工具版本:3.3.2

Gradle sync失败:尝试访问方法kotlin.collections.ArraysKt ___ ArraysKt.copyOfRange([Ljava / lang / Object; II] [Ljava / lang / Object;来自类kotlin.reflect.jvm.internal.calls.CallerImpl $ Method $ Instance

已经尝试了所有可能的方法。请帮我解决这个问题。

Error: Class kotlin.reflect.jvm.internal.FunctionCaller$FieldSetter

Error in Kotlin but using only Java - Class kotlin.reflect.jvm.internal.FunctionCaller$FieldSetter

https://developer.android.com/studio/releases/gradle-plugin#updating-plugin

android kotlin android-gradle
2个回答
1
投票

我在Android studio 3.3.2中面临同样的问题,它不允许我使用Kotlin构建。

降级Android工作室或使用Android Studio Canary解决了我的问题。

我不认为这是一个正确的解决方案。用正确的方法建议我。


0
投票

我遇到了同样的问题,并通过以下链接解决:

https://discuss.kotlinlang.org/t/gradle-dependency-management-plugin-illegalaccesserror-tried-to-access-method-kotlin-collections-arrayskt-arraysjvmkt-copyofrange/10325/4

我想到了。它是依赖管理插件:

    dependencyManagement {
    imports {
    mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
    }
    dependencies {
        //...
    }

在这个POM中,有一个kotlin.version属性需要被覆盖,如下所示:

ext['kotlin.version'] = kotlinVersion

其中kotlinVersion在文件顶部的buildscript块中定义。

© www.soinside.com 2019 - 2024. All rights reserved.