gradle java sdk 호환성 문제 (React-Native Troubleshooting)

김광철
Dec 24, 2020

--

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

FAILURE: Build failed with an exception.* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

gradle 의 java sdk의 버전 호환 문제로 에러 메시지가 뜨게 된다

$ ./android/gradlew -version------------------------------------------------------------
Gradle 6.2
------------------------------------------------------------
Build time: 2020-02-17 08:32:01 UTC
Revision: 61d3320259a1a0d31519bf208eb13741679a742f
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 15.0.1 (Oracle Corporation 15.0.1+9-18)
OS: Windows 10 10.0 amd64
$ java --version
java 15.0.1 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

Gradle에서 호환성 확인 https://docs.gradle.org/6.2/userguide/compatibility.html

Gradlew 6.2 버전은 java sdk 8~13을 필요로 하고 sdk15는 지원하지 않는다고 되어있다.

해결방법

./android/gradle/wrapper/gradle-wrapper.properties 에서 distributionURL를 수정합니다. (6.2 >6.3)

distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zipzipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/dists

--

--

김광철
김광철

No responses yet