Android Studio Build Error - 자바 버전 변경하기 (1.8 > 11)

반응형

에러 내용

안드로이드 스튜디오 빌드시 에러 출력

  • 자바 버전이 낮아서 빌드를 할 수 없음
  • 안드로이드 그래이들 플러그인을 쓰려면 자바 11이 필요
FAILURE: Build failed with an exception.

* Where:
Build file '~~~' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
      Your current JDK is located in C:\Program Files\Java\jdk1.8.0_351\jre
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

해결

안드로이드 스튜디오 자바 버전 변경

  • File - Project Structure

  • SDK Location - Gradle Settings

반응형
  • 하단의 Gradle JDK에서 11 선택
  • 혹은 Add JDK - JDK 설치 폴더 선택]
  • OK

반응형