'Android Gradle Plugin - what should I use in place of incubating abstractions, such as defaultConfig?
I am new to Gradle, and I'm trying to port my android groovy build script to kts.
I have a working build, however Android studio is complaining (all over the place) about my syntax.
For example:
defaultConfig: 'defaultConfig(kotlin.jvm.functions.Function1<? super com.android.build.api.dsl.ApplicationDefaultConfig,kotlin.Unit>)' is marked unstable with @Incubating
'setApplicationId(java.lang.String)' is declared in unstable 'com.android.build.api.dsl.ApplicationBaseFlavor' marked with @Incubating
this goes on & on. When I look at the documentation, I can see that it is incubating, but it doesn't say what to replace with it, etc.
android {
compileSdk = 31
defaultConfig {
applicationId = "myappId"
minSdk = 21
targetSdk = 31
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Should I just ignore these warnings? If so why are they warnings?
I just opened the project, on another machine and do not see the warning. The machine is running the exact same version of Android Studio:
- JVM
- Kotlin
- Gradle
When i click on something like the defaultConfig and navigate to the source, i see that it comes from exact same module. And it is marked as @Incubating.
I also checked the settings>Editor>Inspections and they both have the same settings.
Solution 1:[1]
This warning is nothing to do with Android Studio or compiler. It's from Gradle build system: link
The meaning of the warning is following:
...the feature is currently a work-in-progress and may change at any time.
For my pet-projects I do @Suppress("UnstableApiUsage")
to dismiss it.
But I would strongly recommend you not doing this for commercial/production projects. Better approach is to wait till the feature is stabilized by Gradle developers if you are using latest stable version. Or update to latest stable if possible.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | IGR94 |