google / android-security-lints

Custom security-focused lint checks for Android development
Apache License 2.0
127 stars 7 forks source link

Publication on gMaven requires JDK21+ #6

Closed jozuasijsling-ing closed 3 months ago

jozuasijsling-ing commented 3 months ago

Presumably, this requirement isn't intentional. I did some testing and found two distinct errors depending on AGP version used and whether or not ext.lintVersion is specified as documented:

Error ❌1:

Could not load custom lint check jar file [..]/com.android.security.lint/lint/1.0.0/a0d1f9c8ecd5f10d136e1be580ff6e0bc3f6ae2a/lint-1.0.0.jar java.lang.UnsupportedClassVersionError: com/example/lint/checks/IssueRegistry has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

Error ❌2:

Error verifying bytecode in [...]/com.android.security.lint/lint/1.0.0/a0d1f9c8ecd5f10d136e1be580ff6e0bc3f6ae2a/lint-1.0.0.jar java.lang.IllegalArgumentException: Unsupported class file major version 65

AGP JDK ext.lintVersion Result
8.5.2 17 unspecified 1
$${\color{green}"31.5.1"}$$ 1
21 unspecified
$${\color{green}"31.5.1"}$$
8.5.0 17 unspecified 1
$${\color{green}"31.5.1"}$$ 1
21 unspecified
$${\color{green}"31.5.1"}$$
8.4.0 17 unspecified 1
$${\color{green}"31.5.1"}$$ 1
21 unspecified
$${\color{green}"31.5.1"}$$
8.2.1 17 unspecified 1
$${\color{green}"31.5.1"}$$ 1
21 unspecified 2
$${\color{green}"31.5.1"}$$
bjiang7 commented 3 months ago

Hey jozuasijsling-ing@, thanks for opening the issue. You're absolutely right, I must've compiled the library with a newer JDK version. I've now reuploaded it after compiling it with JDK 17, and you can access this with version 1.0.1.

Let me know if you're still having issues after trying the new version (I'll leave this issue open for you to close, once you confirm the issue is actually fixed).

Thanks for trying out the android-security-lints library :D

jozuasijsling-ing commented 3 months ago

Works for me! Thanks @bjiang7.