Skip to content

引入库后编译报错:Reason: IllegalArgumentException, message: Unsupported class file major version 61. #365

@superoidlau

Description

@superoidlau

` What went wrong:
Execution failed for task ':app:mergeDebugResources'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform CheckVersionLib-2.4.2.aar (com.github.AlexLiuSheng:CheckVersionLib:2.4.2) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
> Execution failed for JetifyTransform: F:\AsData.gradle\caches\modules-2\files-2.1\com.github.AlexLiuSheng\CheckVersionLib\2.4.2\e32ae4ff4c1583629b08ae11aa0630c68b180220\CheckVersionLib-2.4.2.aar.
> Failed to transform 'F:\AsData.gradle\caches\modules-2\files-2.1\com.github.AlexLiuSheng\CheckVersionLib\2.4.2\e32ae4ff4c1583629b08ae11aa0630c68b180220\CheckVersionLib-2.4.2.aar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
`

引入库后项目编译报错:
AGP:3.6.4
gradle:gradle-6.3-all
java版本:11

开启了:
android.useAndroidX=true
android.enableJetifier=true

主要的错误原因:
Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.)

issuetracker上的解决方案说是将enableJetifier去掉或者设为false,但是这样做不可行。

因此有其他方法解决此问题吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions