아래의 오류가 난다면?
BUG! exception in phase 'semantic analysis' in source unit 'C:\workspace\flutter_3.22.0\flutter\packages\flutter_tools\gradle\src\main\groovy\app_plugin_loader.groovy' Unsupported class file major version 65
Java 21에서 컴파일된 .class 파일을 의미
Gradle이 Java 21을 지원하지 않아서 생기는 오류임
Java 버전 17로 맞추기
https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
Java Archive Downloads - Java SE 17.0.12 and earlier
WARNING: Older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. For production use Oracle recommends downloading the late
www.oracle.com
다운로드 후
JAVA_HOME 경로 설정
JAVA_HOME "C:\Program Files\Java\jdk-17"
cmd 확인
만약 run 할 경우
'compileDebugJavaWithJavac' task (current target is 1.8) and 'kspDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version. 이런 오류가 난다?
app/build.gradle
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}
이렇게 변경
사용자의 경우 17이 자꾸 안잡혀서
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.java.home=C:/Program Files/Java/jdk-17
android.useAndroidX=true
android.enableJetifier=true
이렇게 강제로 설정
해결~
'Android 관련' 카테고리의 다른 글
Could not get unknown property 'kotlin_version' for object of type (0) | 2025.05.13 |
---|---|
미디어파이프 연결 오류 (0) | 2025.04.03 |
android:exported 값 설정 기준 (0) | 2025.01.09 |
Android 난독화 - Flutter (0) | 2024.07.31 |
Google Play Console 앱 권한 관리 (0) | 2023.09.06 |