# android


07/01/2022, 8:33 AM
Good afternoon. Please help me find a solution. I have an android project and I want to move a section from the module level gradle to the project level. I am using Kotlin DSL. I found a solution for Groovy but I can't migrate it to Kotlin.
Copy code
def applyAndroid(project) { {

        compileSdkVersion compileVersion

        defaultConfig {
            minSdkVersion minVersion
            targetSdkVersion compileVersion
            versionCode verCode
            versionName verName
            testInstrumentationRunner testRunner

        compileOptions {
            sourceCompatibility = 1.8
            targetCompatibility = 1.8

        kotlinOptions {
            jvmTarget = "1.8"
//            useIR = true
            freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
            freeCompilerArgs += "-Xjvm-default=all"

        testOptions.unitTests {
            includeAndroidResources = true

        buildFeatures {
            aidl = false
            renderScript = false
            resValues = false
            shaders = false

K 1
😶 2
I have a limitation in the Project class, I can't find an android() method


07/05/2022, 4:23 AM
Could you show your Kotlin code and where you move it (is it a separate script, root build.gradle)
in general problem that
is dynamic extension, so you cannot just move function,. you can receive it using name/type or use precompiled script plugins (so it will be available same way as in build.gradle)