https://gradle.com/ logo
Join Slack
Powered by
# community-support
  • f

    Fernando Sena

    08/17/2024, 4:34 AM
    šŸ‘€
    🧵 1
    v
    • 2
    • 1
  • a

    Abanoub Samuel

    08/17/2024, 10:27 AM
    šŸ‘‹ Hello, team!
    šŸ‘‹ 1
  • a

    Abanoub Samuel

    08/17/2024, 10:27 AM
    Can anyone help me with this error ? I am on Linux with Gradle installed via sdkman and using Intellij IDEA for coding Spring Boot app
    v
    • 2
    • 1
  • j

    Javi

    08/17/2024, 7:34 PM
    Is there a channel to talk about the Gradle setup action?
    v
    • 2
    • 1
  • s

    Syeda Ayesha Shamim

    08/19/2024, 6:17 AM
    Build file 'C:\Users\Admin\AndroidStudioProjects\Dagger2\build.gradle.kts' line: 6 Plugin [id: 'com.google.devtools.ksp', version: '1.9.22-1.0.13', apply: false] was not found in any of the following sources: * Try:
    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.
    Get more help at https://help.gradle.org.
    * Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.devtools.ksp', version: '1.9.22-1.0.13', apply: false] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (could not resolve plugin artifact 'com.google.devtools.kspcom.google.devtools.ksp.gradle.plugin1.9.22-1.0.13') Searched in the following repositories: Google MavenRepo Gradle Central Plugin Repository at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolveToFoundResult(DefaultPluginRequestApplicator.java:237) at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$resolvePluginRequests$3(DefaultPluginRequestApplicator.java:167) HOW TO SOLVE THAT
    v
    • 2
    • 4
  • p

    Peter

    08/19/2024, 7:29 AM
    I have an issue, when trying to publish to maven local:
    > Failed to publish publication 'release' to repository 'mavenLocal'
    > org.codehaus.plexus.util.xml.pull.XmlPullParserException: in epilog non whitespace content is not allowed but got / (position: END_TAG seen ...</metadata>\n/... @Dchintal 13:2)
    Can someone help me with this please? Will post configuration in thread.
    • 1
    • 2
  • t

    Thomas Keller

    08/19/2024, 9:01 AM
    So, I stumble upon an usage problem of
    ConfigurableFileCollection
    used in
    SourceTask
    s: Whenever a plugin uses one of those and multiple source directories are added to it (say
    build/generated/foo/kotlin
    and
    build/generated/bar/kotlin
    ), I cannot exclude files from this said file collection via
    exclude("**/build/**")
    or
    exclude("**/generated/**")
    , but only match path parts beyond the configured source directories, e.g.
    **/SomeFile.kt
    . I could not see an API in
    PatternFilterable
    that makes this possible and my naive attempt to use
    FileTreeElement
    via
    Copy code
    exclude { spec ->
        spec.file.absolutePath.contains("**/build/**")
    }
    failed as well. So what do I overlook here?
    v
    • 2
    • 4
  • s

    Sergey Chernov

    08/19/2024, 9:13 AM
    Hello. Is it possible to do a lazy artifact transform? What I actually mean: there is a JAR dependency from remote repository that needs to be unpacked in a task. The problem is that it's eagerly resolved during
    CONFIGURING
    phase, not
    EXECUTING
    like e.g. regular compilation dependency. The problem is that the artifact is quite big and it's resolved in a single-thread CONFIGURING phase (while potentially it could be multi-thread EXECUTING). I tried this approach:
    Copy code
    configurations {
        remoteApp {
            attributes {
                attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "unzipped")
            }
        }
    }
    
    dependencies {
        // example from <https://docs.gradle.org/current/userguide/artifact_transforms.html#artifact_transforms_without_parameters>
        // public abstract class Unzip implements TransformAction<TransformParameters.None> {
        registerTransform(Unzip) {
            from.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "jar")
            to.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "unzipped")
        }
    
        // libs is toml version catalog
        remoteApp libs.remoteApp
    }
    
    def unpackRemoteAppTask = tasks.register('unpackRemoteApp', Copy.class) {
        from({ configurations.remoteApp })
        into layout.buildDirectory.dir("remoteapp/x86")
        fileMode = 0755
        dirMode = 0755
    }
    v
    • 2
    • 5
  • p

    Peter

    08/19/2024, 9:17 AM
    Cannot include build 'build-logic' in build ':my-library. This is not supported yet.
    Is there any alternative to this workaround? https://github.com/researchgate/gradle-release/issues/304#issuecomment-1083646756
    v
    • 2
    • 1
  • b

    Bernhard Posselt

    08/19/2024, 9:43 AM
    I want to share a libs.versions.toml file with my buildSrc; right now I'm using a root settings.gradle.kts and a buildSrc/settings.gradle.kts that both include
    Copy code
    dependencyResolutionManagement {
        versionCatalogs {
            create("libs") {
                from(files("./libs.versions.toml"))
            }
        }
    }
    Is this how you do it? because my intellij seems to get confused and only shows me the buildsrc gradle tasks
    āœ… 1
    n
    • 2
    • 9
  • b

    Bernhard Posselt

    08/19/2024, 10:43 AM
    I've got a task property defined like this:
    Copy code
    abstract class ChangeModuleVersion : DefaultTask() {
        @Input
        val moduleVersion: Provider<String> = project.objects.property<String>()
    and registered like this:
    Copy code
    tasks.register<ChangeModuleVersion>("changeModuleVersion")
    how do I pass I pass the parameter to the task, because ./gradlew changeModuleVersion -PmoduleVersion=0.0.1 gives me a property 'moduleVersion' doesn't have a configured value.
    āœ… 1
    j
    • 2
    • 10
  • s

    Syeda Ayesha Shamim

    08/19/2024, 12:42 PM
    package com.example.hilt import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.viewModels import com.example.hilt.model.UserViewModel import com.example.hilt.model.UserEntity import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class MainActivity : AppCompatActivity() { private val viewModel: UserViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout._activity_main_) viewModel.addUser( UserEntity( id = 0, name = "ayesha", email ="ayesha", password = "123" ) ) } } why it's giving error on import androidx.activity.viewModels,private val viewModel: UserViewModel by viewModels()
    v
    • 2
    • 3
  • h

    Hagar Mohamed

    08/19/2024, 7:05 PM
    Hello everyone, I have an Android Project that builds successfully if I run it once in the server if I run two parallels builds, on one of them I got the following error: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
    c
    • 2
    • 1
  • s

    Syeda Ayesha Shamim

    08/20/2024, 11:42 AM
    Unable to find method ''boolean dagger.internal.codegen.xprocessing.XTypeElements.isKotlinSource(dagger.spi.shaded.androidx.room.compiler.processing.XTypeElement)'' 'boolean dagger.internal.codegen.xprocessing.XTypeElements.isKotlinSource(dagger.spi.shaded.androidx.room.compiler.processing.XTypeElement)' Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project. In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes
  • j

    Javi

    08/20/2024, 1:22 PM
    Just to accelerate the resolution of this issue, is it possible to add some directories as configuration cache input but ignore some subdirectories?
    v
    a
    • 3
    • 98
  • l

    LOHITH KUMAR

    08/20/2024, 1:36 PM
    Hello , I have a multi-module project, and I've been keeping my
    build.gradle
    files DRY by using the
    subprojects
    block in the root project
    build.gradle
    . My question is related to dependency management in this setup. If I specify a dependency (e.g.,
    com.example:library
    ) with
    version1
    in a specific module's
    build.gradle
    , but the same dependency is declared with
    version2
    in the
    subprojects
    block of the root project`build.gradle`, which version of the dependency will actually be used during the build process? I want to understand how Gradle resolves such conflicts when a dependency is declared both in a module-specific
    build.gradle
    and in the
    subprojects
    block with different versions. Thanks in advance for your help!
    v
    • 2
    • 2
  • r

    Roldan Galan

    08/20/2024, 3:45 PM
    Hi all! I am trying to move a module as a child of another module, but I am having problems resolving references to it from other modules. This is in the scope of an Android application (not sure if this would be some constraint in AGP), but sharing it here as looks like a general problem so far. I've already looked into Structuring Projects with Gradle and Multi-Project Build Basics, but I couldn't find any examples specifically about putting modules inside other modules (neither recommendations against this practice). Is there any limitation for it? šŸ¤” Sharing full in a thread to not pollute this channel with a long message. šŸ§µšŸ‘‡
    t
    v
    g
    • 4
    • 17
  • e

    Eug

    08/21/2024, 8:01 AM
    I can not find what java uses gradle profiler for downloading the gradle distribution.
    java
    is set in path, but JAVA_HOME is not set.
    v
    • 2
    • 19
  • t

    Tevin Jeffrey

    08/21/2024, 4:30 PM
    Anyone else notice we can non longer rely on project instances equality since 8.10. Any usage of
    Set<Project>
    is now broken across several of the plugins we use.
  • p

    Peter

    08/22/2024, 11:13 AM
    I've recently been building KMP app and I've noticed it generated
    projects
    reference for all gradle modules. I've tried opening other (non KMP) projects and I couldn't find that kind of property. I guess this is a KMP gradle plugin thing or am I missing something?
    Copy code
    implementation(projects.shared)
    v
    • 2
    • 5
  • p

    Philip W

    08/22/2024, 3:06 PM
    I have a jvm only multi module project using java-test-fixtures and I get an error when storing CC because
    :restclient:jar' (type 'Jar') uses this output of task ':api:jar' without declaring dependency
    . And I don't understand, how this could happen. Do you have any hints where I should look at the Build scan?
    āœ… 1
    v
    • 2
    • 3
  • b

    Brandon Wong

    08/22/2024, 8:08 PM
    hi, I'm trying to first-time build something using a gradle wrapper and within the
    gradle-wrapper.properties
    file, i have the line
    Copy code
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
    whenever i run anything with the
    ./gradlew
    command, it tries to download the bin but stops and times out at 100%. same thing happens if i try to download it through my browser. i found another download site for the bin - is there a workaround that can use that?
  • s

    Stefano Zanella

    08/23/2024, 8:22 AM
    hello, I'm trying to use the
    Sync
    task within a custom plugin to copy files into an intermediate folder for assembling a package's content. I want to be able to configure this directory, as in another task/subproject I need to first generate the content of this directory and in other subprojects I can just use a default. The problem I'm facing is that Gradle detects a non-declared dependency between the output of the preparation task and the input of the
    Sync
    task. I don't want to directly depend on the task as it's an internal task to the plugin. Is there a way to specify the source of a
    Sync
    task as an input property? Some example code to better explain:
    Copy code
    // subprojectA (build.gradle.kts)
    val pkgSources = layout.buildDirectory.dir("generated/pkgSource")
    
    myPlugin {
      sourceDir = pkgSources
    }
    
    tasks.register("foo", Sync::class.java) {
      from("someFolder")
      into(pkgSources)
    }
    
    // custom plugin
    // has extension with sourceDir DirectoryProperty
    
    tasks.register("prepare", Copy::class.java) {
      from(ext.sourceDir) // points to pkgSources
      into("somewhere/else")
    }
    
    tasks.register("buildPackage") {
      dependsOn("prepare")
    }
    If I call
    buildPackage
    I get the non-explicit dependency error, and I assume it's because the call to
    from()
    doesn't set an actual input for the
    Copy
    task? Or am I missing something?
    a
    v
    • 3
    • 19
  • a

    Alexandru Hadăr

    08/23/2024, 9:28 AM
    I'm in my
    root
    project where i have a
    build.gradle
    file. I also have a subproject here, called
    app
    . (this is an android project). I'm trying to run a script after each
    build
    task. However, gradle can't find that
    build
    task. In my root's
    build.gradle
    I have :
    Copy code
    tasks.named("build") {
        finalizedBy("myTask")
    }
    But I keep getting:
    Copy code
    Task with name 'build' not found in root project 'MyProject'.
    But if I ran
    ./gradlew tasks
    I get
    Copy code
    Build tasks
    -----------
    assemble - Assemble main outputs for all the variants.
    assembleAndroidTest - Assembles all the Test applications.
    assembleUnitTest - Assembles all the unit test applications.
    build - Assembles and tests this project.
    v
    • 2
    • 10
  • j

    Jessica Bussert

    08/23/2024, 3:28 PM
    Hi Folx, I’m a noob here and was hoping for some help. I had an outside dev build an Android BLE app for me as well as some custom firmware for an ESP32 module. Shortly after he delivered the project and was paid, the dev flaked out and disappeared. I’m now trying to pick up the pieces myself and having a few struggles in the process. I can handle the firmware without issue but I’ve not done any Android development in the past. I’m sure I can eventually figure it out but for the time being I can’t even get the code to build in android studio. I’m missing the autolinking.gradle, don’t know how to create it, and don’t even know the dependencies I’ll need to populate it. Can anyone point me to a tutorial or example page for this file? Thanks, J
    a
    e
    • 3
    • 3
  • m

    M3

    08/23/2024, 8:50 PM
    General understanding question - what are the mechanisms for injecting configuration at build time on the CI/CD server? For example, we want to ensure that every project is getting its dependencies via our Artifactory instance - I can see how we can tell the user to configure their project with artifactory plugin in build.gradle file, but it depends on them doing the right thing in every project and us trusting them to do the right thing. Is there a way to automatically inject plugins/configuration into the build project that does not depend on contents of build.gradle? Or at least a way to check that a plugin is installed/used/configured? I found the enforcer plugin, but again, without ability to apply it from outside the source code, its is not of much use, as both the enforcement rules and what they are applying to are written by same people in same place. There must be some equivalent of Maven’s settings.xml? What am i missing?
    a
    v
    • 3
    • 6
  • j

    jaroslav

    08/25/2024, 2:33 PM
    i am trying to upload my expo project .. and cant resolve this error , i tried to fix this error by upgrading the version o core or adding a version of sdk , someone can help me with this ?
    v
    • 2
    • 1
  • m

    Martin Nguyen

    08/26/2024, 4:11 AM
    On the Gradle user guide, there is a section about hidden tasks: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:hidden_tasks
    Gradle doesn’t support marking a task as private.
    However, tasks will only show up when running
    :tasks
    if
    task.group
    is set or no other task depends on it.
    So for the code example:
    Copy code
    tasks.register("helloTask") {
        println("Hello")
    }
    I understand this task doesn’t show up in
    ./gradlew tasks
    because no group has been assigned to it. However since the docs say ā€œor no other task depends on itā€, since there are no tasks depending on this task then shouldn’t it still show in
    ./gradlew tasks
    ?
    v
    • 2
    • 1
  • p

    Philip W

    08/26/2024, 8:32 AM
    Can you use ArtifactTransformation to transform two artifacts from different configurations with different attributes (Attribute.Foo and Attribute.Bar) into a new file with a new attribute (Attribute.Baz)? Or should I use a task?
    v
    • 2
    • 2
  • b

    businge brian

    08/26/2024, 8:55 AM
    Copy code
    ../gradle/home/caches/8.6/kotlin-dsl/scripts/5c95e8bdea9d1f510522d6cd009e3ea4/metadata.bin (No such file or directory)
    getting the above issue when syncing my project, any idea as to why this is happening?
    p
    v
    • 3
    • 9
1...585960...102Latest