Unable to use the Accessory SDK

I’m trying to integrate the Accessory SDK into a library, but trying to compile a project using said library throws an error.
After a bit of research, it seems like the Accessory SDK is being compiled against an old version of Java, and isn’t compatible with the new verification scheme found in Java 1.7 and up.

Error here:

Expecting a stackmap frame at branch target 116
Exception Details:
Location:
com/samsung/android/sdk/accessory/RegisterUponInstallReceiver.onReceive(Landroid/content/Context;Landroid/content/Intent;)V @1: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2cc6 0073 2cb6 0016 c600 6c2c b600 1612
0000010: 05b6 0021 9900 60b2 0012 bb00 1159 1201
0000020: b700 232b b600 15b6 0024 b600 25b8 0017
0000030: 57bb 000f 2bb7 001f a700 144d b200 1212
0000040: 032c b800 22b6 0020 b800 1857 2ab6 0019
0000050: 4dbb 000e 592b b600 14b7 001c 594c b600
0000060: 1d4e bb00 0c59 1202 2d2c b700 1ab6 001b
0000070: 2bb6 001e b1
Exception Handler Table:
bci [49, 56] => handler: 59
java.lang.VerifyError: Expecting a stackmap frame at branch target 116
Exception Details:
Location:
com/samsung/android/sdk/accessory/RegisterUponInstallReceiver.onReceive(Landroid/content/Context;Landroid/content/Intent;)V @1: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2cc6 0073 2cb6 0016 c600 6c2c b600 1612
0000010: 05b6 0021 9900 60b2 0012 bb00 1159 1201
0000020: b700 232b b600 15b6 0024 b600 25b8 0017
0000030: 57bb 000f 2bb7 001f a700 144d b200 1212
0000040: 032c b800 22b6 0020 b800 1857 2ab6 0019
0000050: 4dbb 000e 592b b600 14b7 001c 594c b600
0000060: 1d4e bb00 0c59 1202 2d2c b700 1ab6 001b
0000070: 2bb6 001e b1
Exception Handler Table:
bci [49, 56] => handler: 59

Hello,
If your App targets Android R(30) and interacts with other apps which is installed on the same device, you need to use the element in the Manifest file so that system knows which other apps to show to your app.

Kindly include the below piece of code in the manifest file.

<manifest package="com.your.app.package">
 <queries>
 <package android:name="com.samsung.accessory" />
 </queries>
    ...
</manifest>

For more details, please visit the below link

Yes I’m aware of the package query limitations, and I already have that code in my manifest.
The issue stems from me targeting Java 1.8, and the library is compiled with a version that’s either 1.6 or lower. As of Java 1.7, bytecode verification changed slightly, which causes the failing check.
The workaround now is to pass “-noverify” in for the JVM args, but this still isn’t great and you still need to resolve the underlying issue.

Nowhere did I mention I’m targeting Android SDK 30 (which I am), so while I appreciate you taking the time to leave a detailed answer, please read the question before answering next time.