Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SafetyNetDatabase cannot be cast to java.lang.AutoCloseable #1816

Closed
ale5000-git opened this issue Nov 4, 2022 · 0 comments
Closed

SafetyNetDatabase cannot be cast to java.lang.AutoCloseable #1816

ale5000-git opened this issue Nov 4, 2022 · 0 comments
Labels
Milestone

Comments

@ale5000-git
Copy link
Member

ale5000-git commented Nov 4, 2022

On Nougat when opening SafetyNet preferences I get: SafetyNetDatabase cannot be cast to java.lang.AutoCloseable

Problematic line:

val apps = SafetyNetDatabase(requireContext()).use { it.recentApps }

Logcat:

01-01 05:20:05.777 12969 12969 E AndroidRuntime: FATAL EXCEPTION: main
01-01 05:20:05.777 12969 12969 E AndroidRuntime: Process: com.google.android.gms:ui, PID: 12969
01-01 05:20:05.777 12969 12969 E AndroidRuntime: java.lang.ClassCastException: org.microg.gms.safetynet.SafetyNetDatabase cannot be cast to java.lang.AutoCloseable
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at org.microg.gms.ui.SafetyNetPreferencesFragment$updateContent$1$1.invokeSuspend(SafetyNetPreferencesFragment.kt:106)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
01-01 05:20:05.777 12969 12969 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
01-01 05:20:05.780  2370  2521 W ActivityManager:   Force finishing activity com.google.android.gms/org.microg.gms.ui.SettingsActivity

Possible solution:
https://stackoverflow.com/a/73502339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants