Flutter Error: Exception: Gradle task assembleDebug failed with exit code , Build failed

김병민·2023년 3월 14일
0

그냥 내 err

목록 보기
16/17
post-thumbnail
FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Users/tt/Desktop/flutter/testhello/flutter_application_1/android/settings.gradle' (/Users/tt/.gradle/caches/7.5/scripts/cmhfpkcf7ocfllmygpx5lw7ur).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

* 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

BUILD FAILED in 326ms
Exception: Gradle task assembleDebug failed with exit code 1
Exited

찾아보니 Gradle과 java가 버전이 달라서 생기는 오류라고 함

그래서 gradle-wrapper.properties 버전도 변경해보고 Java 버전도 변경에 보고 했지만 전혀 효과가 없었음

그러던 중 JAVA_HOME으로 변경 시 gradle 안에서도 환경변수를 설정해줘야한다는 글을 봄

해결

  1. 높은 버전의 자바로 변경 ( 8버전하니깐 안됨 )
    변경방법

  2. /android/gradle.properties 파일 마지막에

org.gradle.java.home=/Library/Java/JavaVirtualMachines/[본인이 사용하는 자바 버전을 넣어주세요]/Contents/Home

다음과 같이 넣어주고 저장

  1. 해결
profile
I'm beginner

0개의 댓글