1

After suppressing the OptIn warning, I was expecting it would go away, but it's still popping up after compile, any way to get rid of it?

@Suppress("OPT_IN_IS_NOT_ENABLED")
@OptIn(ExperimentalMaterialApi::class)

enter image description here

David Aleksanyan
  • 2,953
  • 4
  • 29
  • 39
  • Have you tried passing in the option to the compiler itself? You should be able to do it on your project's gradle file. – takecare Apr 14 '22 at 09:49
  • I've tried putting it in command line options but that didn't work, there's probably a way to add it to gradle somehow but I'm not sure how. Do you have a link I could try? – David Aleksanyan Apr 14 '22 at 11:06
  • 1
    You should be able to add it to your gradle file. It should be something like: ``` tasks.withType { kotlinOptions { freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" } } ``` Otherwise you can search for "set kotlin compiler opt in arguments gradle file" – takecare Apr 14 '22 at 14:08
  • Thanks I found the right page by searching for your keyword – David Aleksanyan Apr 15 '22 at 08:25

1 Answers1

2

According to this question: How to set Opt in what resolves the problem is adding the following snippet to build.gradle (app)

kotlin.sourceSets.all {
    languageSettings.optIn("kotlin.RequiresOptIn")
}
David Aleksanyan
  • 2,953
  • 4
  • 29
  • 39