Akshay
Akshay

Reputation: 103

Gradle sync failed: tried to access method kotlin.collections.ArraysKt___ArraysKt.copyOfRange

Installed the latest version of Android Studio(v3.3.2) and when trying to build the project and the following error occurs.

Gradle tools version: 3.3.2

Gradle sync failed: tried to access method kotlin.collections.ArraysKt___ArraysKt.copyOfRange([Ljava/lang/Object;II)[Ljava/lang/Object; from class kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance

Tried all the possible ways already. Please help me in fixing this.

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

Upvotes: 2

Views: 1862

Answers (2)

zhukunqian
zhukunqian

Reputation: 113

I meet the same problem and solved by follow link:

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

I figured it out. It was the dependency management plugin:

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

In this POM, there is a kotlin.version property that needs to be overridden like this:

ext['kotlin.version'] = kotlinVersion

Where kotlinVersion is defined in my buildscript block at the top of the file.

Upvotes: 0

raj
raj

Reputation: 124

I faced the same issue with Android studio 3.3.2 where it didn't allow me to build with Kotlin.

Downgrading the Android studio or using the Android Studio Canary solved my issue.

I don't think its a right solution. Suggest me with a right approach.

Upvotes: 1

Related Questions