android block deprecated with AGP 9.0


The android block seems to be deprecated:

> 'fun Project.android(configure: Action<BaseAppModuleExtension>): Unit' is deprecated. Replaced by com.android.build.api.dsl.ApplicationExtension. > > This class is not used for the public extensions in AGP when android.newDsl=true, which is the default in AGP 9.0, and will be removed in AGP 10.0.

@Deprecated
public fun org.gradle.api.Project.android(
    configure: org.gradle.api.Action<com.android.build.gradle.internal.dsl.BaseAppModuleExtension>
): Unit

I've also read https://developer.android.com/build/releases/agp-9-0-0-release-notes

There is kotlin.androidLibrary {}, but how to use the com.android.build.api.dsl.ApplicationExtension?

2
Jan 30 at 10:44 PM
User AvatarMartin Zeitler
#android#android-gradle-plugin#deprecated#android-gradle-9.0

Accepted Answer

It's not KMP, but an Android project with built-in Kotlin and android.newDsl=true.

https://cs.android.com/search?q=file:com/android/build/api/dsl/ApplicationExtension.kt+class:com.android.build.api.dsl.ApplicationExtension

User AvatarMartin Zeitler
Jan 30 at 11:16 PM
1