I created a new Android project using Android Studio version – Electric Eel. And I was trying to migrate gradle scripts from groovy
to kotlin DSL
, met warnings.
In last project developed on previous version of Android Studio – Chipmunk, script was clean. The scripts between last project and new project are equal.
I want to remove the warning message in the right way not supressing them. I know what the annotation(@Incubating
) means.
Here’s the settings.gradle.kts
.
Comments are the warnings I encountered.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
// 'getRepositoriesMode()' is declared in unstable interface 'org.gradle.api.initialization.resolve.DependencyResolutionManagement' marked with @Incubating
// 'org.gradle.api.initialization.resolve.RepositoriesMode' is marked unstable with @Incubating
// 'FAIL_ON_PROJECT_REPOS' is declared in unstable enum 'org.gradle.api.initialization.resolve.RepositoriesMode' marked with @Incubating
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// 'repositories(org.gradle.api.Action<? super org.gradle.api.artifacts.dsl.RepositoryHandler>)' is declared in unstable interface 'org.gradle.api.initialization.resolve.DependencyResolutionManagement' marked with @Incubating
repositories {
google()
mavenCentral()
}
}
rootProject.name = "MyNewProject"
include(":app")
My IDE, gradle, agp versions:
- IDE: Electric Eel (2022.1.1, Build #AI-221.6008.13.2211.9477386)
Android Studio Electric Eel | 2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 11, 2023
Runtime version: 11.0.16+8-b2043.64 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
- Gradle: 7.5
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-bin.zip
- agp: 7.4.0
(in build.gradle
, which is still with groovy
)
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
2
Answers
I double checked the Inspection settings both IDE versions, Unstable API Usage options are all enabled. The options includes correct annotation -
org.gradle.api.incubating
.I think electric eel version resolves a bug(Actucally I'm not sure), but this is not resolved clearly, until they release it stable API or other way...
For now I added
@file:Suppress("UnstableApiUsage")
at the top of each gradle script.Add @Suppress("UnstableApiUsage") to fix temporarily problem in the interested code like