-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Type: invalidThis doesn't seem rightThis doesn't seem right
Description
Description
When instrumenting in debug builds using Jacoco, binaries fail to verify due to this error:
java.lang.VerifyError: Verifier rejected class stardevicediscoverymanager:
failed to verify: java.lang.Object stardevicediscoverymanager:
[0x103] expected to be within a catch-all for an instruction where a monitor is held
From what I can read online, this is a common issue when instrumenting java/kotlin code targeting an older Java version. The offending code is most likely something of the format:
val obj = Any()
try {
synchronized(obj) {
Log.d("Test", "Succeeded")
}
} catch (ex: Exception) {
Log.e("Test", "Failed", ex)
}
Oftentimes, the solution to this is the move the synchronized block outside of the try/catch like so:
val obj = Any()
synchronized(obj) {
try {
Log.d("Test", "Succeeded")
} catch (ex: Exception) {
Log.e("Test", "Failed", ex)
}
}
Jacoco Issue: jacoco/jacoco#1381
Your device where the bug occurs
- Device:
Android Emulator / Microtouch Android Device - OS:
Android 13.0 - Browser:
N/A - Version
SDK Version 1.11.1
Your printer
- Model Names:
N/A - Firmware Version:
N/A - Interface:
N/A
Your development environment
MacOS 15.7.1
To Reproduce
Steps to reproduce the behavior:
- Clone this fork of the example Android App
- Run app
- Start printer discovery flow
- See crash/error
Expected behavior
Expect no error
Metadata
Metadata
Assignees
Labels
Type: invalidThis doesn't seem rightThis doesn't seem right