Proguard: threadId not found
Describe the bug
I updated to bugsnag 6.19.0, and now proguard won't allow my app to build.
It complains about:
Warning: com.bugsnag.android.ThreadState: can't find referenced method 'long threadId()' in library class java.lang.Thread
This seems indeed valid, since Android added it in API level 36. https://developer.android.com/reference/java/lang/Thread#threadId()
Am I supposed to build my project with target SDK 36?
Seeing it in active use in ThreadState in bugsnag sdk, I am wondering if this won't lead to crashes on older Android versions?
I see that the change is backwards compatible.
@Suppress("DEPRECATION")
private val JavaThread.threadId: Long
get() =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
threadId()
} else {
id
}
Maybe good to add a ignore to the proguard rules?
Hi @peterdk,
I’m not seeing the same warning when using compileSdk 35 and v6.19.0 of the bugsnag-android notifier. Please can you let us know:
-
Your AGP and R8 versions
-
Your
compileSdkversion -
How you are building your app
-
Confirm that adding -
dontwarn com.bugsnag.android.ThreadStateto your Proguard rules suppresses the warning
Hi,
I am using it in quite a old project, so might be to do with that.
compileSDK 35 AGP 7.4.2 Proguard 9.1.7 (not R8)
And indeed, adding -dontwarn fixes my CI build
Hi @peterdk
Thanks for sharing those details.
We have a PR open with a possible fix for the Proguard warning you are seeing. Please can you confirm whether the PR uses the same -dontwarn rule that you are using to fix the issue?
Hi,
Ah great.
I used a different dontwarn rule:
-dontwarn com.bugsnag.android.ThreadState
But I will try the one from the PR to see if that has same effect.
Peter
Op 11 nov 2025, om 18:33 heeft Hannah Syed @.***> het volgende geschreven:
hannah-smartbear left a comment (bugsnag/bugsnag-android#2319)
Hi @.***(https://github.com/peterdk)
Thanks for sharing those details.
We have a PR open with a possible fix for the Proguard warning you are seeing. Please can you confirm whether the PR uses the same -dontwarn rule that you are using to fix the issue?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
The change in the PR indeed fixes it for me.
Hi @peterdk
Thanks for confirming. We’ll let you know when we release a new version of bugsnag-android containing the fix for that warning.
Hi @peterdk,
Just wanted to let you know that v6.20.0 of bugsnag-android contains the fix for the Proguard warning you were seeing.
Please do let us know if you have any further questions.