Skip to content

'HubAdapter' is deprecated & 'LoadClass' is deprecated & unsafe use of a nullable receiver of type Thread.UncaughtExceptionHandler #3197

@elitemahdi

Description

@elitemahdi

Platform

Flutter Mobile Android

Obfuscation

Disabled

Debug Info

Disabled

Doctor

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.35.1, on Microsoft Windows [Version 10.0.26100.4946], locale en-US)
[√] Windows Version (Windows 11 or higher, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6)
[√] Android Studio (version 2025.1.2)
[√] VS Code (version 1.103.2)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

Version

9.6.0

Steps to Reproduce

ran "flutter build apk --release" in windows 11 and while building release apk i got these exception:

exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutter.kt:75:50: warning: 'toUpperCase(Locale): String' is deprecated. Use uppercase() instead.
exception: val sentryLevel = SentryLevel.valueOf(it.toUpperCase(Locale.ROOT))
exception: ^^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutter.kt:168:37: warning: 'toUpperCase(Locale): String' is deprecated. Use uppercase() instead.
exception: Type.valueOf(it.toUpperCase(Locale.ROOT))
exception: ^^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:18:18: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: import io.sentry.HubAdapter
exception: ^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:21:31: warning: 'LoadClass' is deprecated. Deprecated in Java
exception: import io.sentry.android.core.LoadClass
exception: ^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:235:13: warning: 'getter for defaultDisplay: Display!' is deprecated. Deprecated in Java
exception: ?.defaultDisplay
exception: ^^^^^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:291:21: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: val options = HubAdapter.getInstance().options
exception: ^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:305:21: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: val options = HubAdapter.getInstance().options
exception: ^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:401:19: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: val options = HubAdapter.getInstance().options as SentryAndroidOptions
exception: ^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:435:5: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: HubAdapter.getInstance().close()
exception: ^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:452:7: warning: unsafe use of a nullable receiver of type Thread.UncaughtExceptionHandler?
exception: mainThread.uncaughtExceptionHandler.uncaughtException(mainThread, exception)
exception: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
exception: c:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-9.6.0\android\src\main\kotlin\io\sentry\flutter\SentryFlutterPlugin.kt:467:19: warning: 'HubAdapter' is deprecated. Deprecated in Java
exception: val options = HubAdapter.getInstance().options
exception: ^^^^^^^^^^

Expected Result

build without exception and error in terminal for fist time.

Actual Result

at first i built the apk and got the exeptions, after got exeption, retry and didn't get any exepetion or warning in terminal and built successfuly

Are you willing to submit a PR?

None

Metadata

Metadata

Assignees

Projects

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions