Android Studio Build Error - Class Has Been Compiled By A More Recent Version Of The Java Environment

์—๋Ÿฌ ๋ฉ”์‹œ์ง€

Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0.

์ฝ์–ด๋ณด๋ฉด ์ž๋ฐ” ๋ฒ„์ „์ด ์•ˆ ๋งž๋Š”๋‹ค๋Š” ์–˜๊ธฐ๋‹ค.
์ด ๊ธ€์„ ๋ณด๋Š” ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด Java8์—์„œ Java11๋กœ ์ ํ”„ํ•˜๋ ค๋Š” ๊ณผ์ • ์ค‘์— ์žˆ์„ ๊ฒƒ์ด๋‹ค.

stackoverflow์— ๋Œ์•„๋‹ค๋‹ˆ๋Š” ๋‚ด์šฉ์„ ์ด๊ฒƒ์ €๊ฒƒ ํ•ด๋ด๋„ ์•ˆ๋๋Š”๋ฐ ํ—ˆ๋ฌดํ•˜๊ฒŒ ํ•ด๊ฒฐํ–ˆ๋‹ค.

Gradle JDK๋ฅผ ์ตœ์‹ ์œผ๋กœ ๋ณ€๊ฒฝ

Pasted image 20221007152025.png
1.8์—์„œ 11๋กœ ๋ฐ”๊ฟ”์คฌ๋‹ค. ๋‚ด๊ฐ€ ์„ค์น˜ํ•œ ๊ธ€๋กœ๋ฒŒ ์ž๋ฐ” ๋ฒ„์ „์— ๋งž์ถ˜ ๊ฒƒ.

build.gradle์—์„œ ํ”„๋กœ์ ํŠธ

์›๋ž˜ 1.8์—์„œ ์ปดํŒŒ์ผํ–ˆ๋˜ ํ”„๋กœ์ ํŠธ์˜ app/build.gradle์— compileOptions ์ถ”๊ฐ€.

android {
	...
	compileOptions {  
	    sourceCompatibility JavaVersion.VERSION_1_8  
	    targetCompatibility JavaVersion.VERSION_1_8  
	}
}

์‚ฝ์งˆ 2์‹œ๊ฐ„.
The End.
Good Luck.