How can I resolve the java.lang.UnsupportedClassVersionError for dagger/hilt/android/plugin/HiltGradlePlugin?

I’m encountering an issue during the build process of my Android project using AWS CodeBuild. The build fails with the following error:

[Container] 2024/08/07 06:53:09.877690 Running command echo Building the project
Building the project

[Container] 2024/08/07 06:53:09.883192 Running command ./gradlew :app:bundleRelease
Downloading https://services.gradle.org/distributions/gradle-7.3.3-bin.zip
………………………………………………………………………………………………..
Unzipping /root/.gradle/wrapper/dists/gradle-7.3.3-bin/6a41zxkdtcxs8rphpq6y0069z/gradle-7.3.3-bin.zip to /root/.gradle/wrapper/dists/gradle-7.3.3-bin/6a41zxkdtcxs8rphpq6y0069z
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-7.3.3-bin/6a41zxkdtcxs8rphpq6y0069z/gradle-7.3.3/bin/gradle

Welcome to Gradle 7.3.3!

Here are the highlights of this release:

  • Easily declare new test suites in Java projects
  • Support for Java 17
  • Support for Scala 3

For more details see https://docs.gradle.org/7.3.3/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • What went wrong:
    java.lang.UnsupportedClassVersionError: dagger/hilt/android/plugin/HiltGradlePlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

dagger/hilt/android/plugin/HiltGradlePlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Context:

–> I am using AWS CodeBuild for my CI/CD pipeline.
–> The project uses Dagger Hilt for dependency injection.

the below is my buildspec.yml

version: 0.2

phases:
build:
commands:
– aws s3api get-object –bucket release-key.jks –key release-key.jks ./releaseKey.jks
– cp ./releaseKey.jks ${CODEBUILD_SRC_DIR}/app/releaseKey.jks
– echo Writing keyPassword
– echo $keyPassword
– export STORE_FILE=releaseKey.jks
– export KEY_ALIAS=$keyAlias
– export KEY_PASSWORD=$keyPassword
– export STORE_PASSWORD=$storePassword
– ./gradlew :app:bundleRelease

artifacts:
files:
– app/build/outputs/bundle/release/app-release.aab

How can I resolve the UnsupportedClassVersionError for dagger/hilt/android/plugin/HiltGradlePlugin?

What I have tried:

–> Verifying that the Gradle version used is compatible with Java 11.
—> Ensuring that the correct version of Java is being used during the build process.
but when I am installing JDK 11 then it is throwing some issues related to apt-get update

the error is

[Container] 2024/08/06 10:35:24.443386 Command did not exit successfully apt-get update exit status 100
[Container] 2024/08/06 10:35:24.446502 Phase complete: INSTALL State: FAILED
[Container] 2024/08/06 10:35:24.446521 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: apt-get update. Reason: exit status 100

i dont knwo how to solve this issue

New contributor

Arbaz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật