Hi! It seems I've got a redundant Gradle setup sin...
# gradle
t
Hi! It seems I've got a redundant Gradle setup since I have
gradle/
,
gradlew
, and
gradle.bat
both at the project top-level and within
android/
. I noticed because I had to update my gradle version in two separate
gradle/wrapper/gradle-wrapper.properties
. But if I delete these files under
android/
, I get
Task 'wrapper' not found in project ':android'.
. What other changes would I need to make? Or do I have to keep both sets? If so, is there any way I can factor out the Gradle version into a single file?
v
Uhm, definitely sounds fishy. You should not need those files there. But who is complainig about missing
wrapper
task when you do what? That implicit task is probably just added to the root project, but it's also strange why those files change that. Except maybe if in the parent project you have some logic in the settings script that adds a directory as subproject if those files are not found or as subbuild if the wrapper files are found or something like that. But impossible to say without seeing your build.
t
@Vampire Here's my root `settings.gradle.kts`:
Copy code
include(":android")
include(":shared")
include(":SharedCode")
My root `build.gradle.kts`:
Copy code
buildscript {

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.1.2")
        classpath("com.android.tools.build:gradle-api:7.1.2")
        // required by Firebase and possibly others
        classpath("com.google.gms:google-services:4.3.10")

        // Add the Firebase Crashlytics Gradle plugin.
        val KOTLIN_VERSION: String by project
        val SQL_DELIGHT_VERSION: String by project
        classpath("com.google.firebase:firebase-crashlytics-gradle:2.8.1")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION")
        classpath("org.jetbrains.kotlin:kotlin-serialization:$KOTLIN_VERSION")
        classpath("com.squareup.sqldelight:gradle-plugin:$SQL_DELIGHT_VERSION")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()

        maven {
            url = uri("<https://maven.google.com/>")
            name = "Google"
        }
    }
}

tasks.register("clean") {
    doFirst {
        delete(rootProject.buildDir)
    }
}
I'm not sure the exact source of the error message but I think it goes through
gradlew
. This is what I get in the Android Studio build output when I do a Gradle sync:
Copy code
Starting Gradle Daemon...
Gradle Daemon started in 697 ms

> Configure project :android
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: <https://docs.gradle.org/7.3.3/userguide/upgrading_version_6.html#jcenter_deprecation>
	at Build_gradle$3.invoke(build.gradle.kts:208)
	(Run with --stacktrace to get the full stack trace of this deprecation warning.)

> Configure project :SharedCode
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.


FAILURE: Build failed with an exception.

* What went wrong:
Task 'wrapper' not found in project ':android'.
I can't seem to find any reference in my git repo that would set up this dependency
v
I have no idea from the info you showed or why removing the wrapper files should change anything. But if it only happens when syncing in AS, maybe you configured to run that task after sync in AS.