what is a deoptimization request on un-deoptimizable method in Android Studio?

1.9k Views Asked by At

I'm running my app in Kotlin and there is no error, but I keep getting these warnings:

W/app: Got a deoptimization request on un-deoptimizable method boolean libcore.io.Linux.access(java.lang.String, int) W/app: Got a deoptimization request on un-deoptimizable method java.lang.Class java.lang.Class.classForName(java.lang.String, boolean, java.lang.ClassLoader) W/app: Got a deoptimization request on un-deoptimizable method boolean libcore.io.Linux.access(java.lang.String, int)

I wonder if this is something that will make my app crash in the future and if there is anything I could do to avoid it.

2

There are 2 best solutions below

1
Osam Alek On

It looks like you’re getting warnings when building your Kotlin Android app. These warnings are not errors and they won’t make your app crash. However, it’s still a good idea to address them as they might indicate potential issues with your code.

One way to address these warnings is to make the Kotlin compiler treat warnings as errors. You can do this by adding the following code inside the allprojects block of your project-level build.gradle file:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.allWarningsAsErrors = true

}

0
Alan Mejia On

I had a similar issue, the logcat used to print a bunch of warnings with the message:

Got a deoptimization request on un-deoptimizable method boolean libcore.io.Linux.access

That happened when I was trying to debug a few function calls using the debugger, and every time I launched the debugger the app was very slow and the logcat had a bunch of warnings saying the same, so I removed all the breakpoints, and it worked fine, I had like 7 breakpoints in different files and android studio was showing warnings that weren't part of the code and the emulator was unresponsive

enter image description here