https://gradle.com/ logo
Docs
Join the conversationJoin Slack
Channels
android
caching
community-news
community-support
config-avoidance
configuration-cache
contributing
dependabot
dependency-management
design
design-specs
developer-productivity-engineering
docs
dpe-summit
feed
file-system-watching
flutter
general
gradle-enterprise
jobs
kotlin-dsl
linen
maven
migrating-from-ant
migrating-from-maven
native
performance
playframework
plugin-development
releases
roadmap
self-promotion
Powered by Linen
android
  • k

    Kadir İşler

    02/16/2023, 3:04 PM
    Hi guys. I need your help please :))
    c
    e
    d
    • 4
    • 4
  • c

    Cicero Hellmann

    02/16/2023, 3:50 PM
    Hey, so I’ve been trying to learn a little bit more about Gradle. I’m using github runners. Our repo has several sub modules, around 15. I’m running android builds with instrumented tests. The following comments are regarding instrumented testes. This tests take, in average, 28 minutes on the git runner, runs fine in the local machine, like 5 minutes. I’m currently investigating something called “Transforming”, like the following snippet.
    Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with IdentityTransform
    5918
    Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with ExtractAarTransform
    5919
    Transforming ui-tooling-1.3.3.aar (androidx.compose.ui:ui-tooling:1.3.3) with AarTransform
    In this build I picked the Transforming operation is happening 64721 times. For example
    Transforming lifecycle-runtime-ktx-2.5.1.aar (androidx.lifecycle:lifecycle-runtime-ktx:2.5.1) with IdentityTransform
    happens 186 time in one build. And there are multiple transformations for this specific library. I had this linked to me https://docs.gradle.org/current/userguide/artifact_transforms.html But I couldn’t make much sense of how this could impact mu build or how I could use it to speed my build up. Could someone tell me what is this and why is it happening so often? How could I prevent it?
    n
    • 2
    • 14
  • m

    Mike Cumings

    02/17/2023, 9:53 PM
    Hey @no, in your DroidCon talk on Keeping Your Gradle Builds In Top Shape you mentioned that Android instrumentation test results can now be uploaded to gradle enterprise. I can't seem to find any info on this capability. Can you please point me in the right direction?
    c
    n
    • 3
    • 2
  • c

    Colton Idle

    02/18/2023, 2:13 AM
    is there any documentation for removing this block of code that every android studio project used to come with out of the box?
    tasks.register("clean", Delete::class) {
        delete(rootProject.buildDir)
    }
    id like to delete it, but no one knows why its there and what would happen if we removed it. lmao
    p
    e
    e
    • 4
    • 12
  • v

    Vaios Tsitsonis

    02/20/2023, 2:07 PM
    Hello! Is there any example of how to aggregate tests results in a multi module project?
    e
    • 2
    • 2
  • a

    Anthony Kasapi

    02/20/2023, 10:26 PM
    Hey everyone. I'm having trouble generating the AAB with
    ./gradlew bundleRelease
    m
    • 2
    • 1
  • a

    Anthony Kasapi

    02/20/2023, 10:27 PM
    I made a StackOverflow post about it here: https://stackoverflow.com/questions/75513962/error-when-generating-release-aab-in-react-native
  • a

    Anthony Kasapi

    02/20/2023, 10:27 PM
    Any help would be much appreciated! 😊
  • s

    Sahil Arora

    02/21/2023, 7:00 AM
    Hi I am facing an issue while I am running bundle release on my ide
  • s

    Sahil Arora

    02/21/2023, 7:00 AM
    FAILURE: Build failed with an exception. * Where: Script 'C:\Users\Sahil Arora\Downloads\flutter_windows_3.3.10-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159 * What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'.
    Process 'command 'C:\Users\Sahil Arora\Downloads\flutter_windows_3.3.10-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    * Try:
    Run with --stacktrace option to get the stack trace.
    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
  • e

    Esa Firman

    02/21/2023, 3:06 PM
    Hi, I got these warnings after upgrading AGP 7.1.2 to 7.4.1 After checking, the code that trigger this is a dependency substitution rules in our plugin, something like this:
    project.configurations.configureEach {
      resolutionStrategy.dependencySubstitution {
        modulesToBeSubstituted.forEach { A ->
          substitute(module(A)).using(project(A))
        }
     }
    }
    And checking the AGP code to avoid this warning we need to resolve it after task graph is ready. After wrapping the code above in
    taskGraph.whenReady
    the warning is gone and the substitution is working correctly. Questions: 1. Why a dependency substitution rules in our plugin triggering a dependency resolution? We have another rules inside a gradle script (*.gradle) but it’s working fine 2. Will there be an issue with adding a substitution rules after task graph ready? 3. What’s the alternative in this case? Thank you
    • 1
    • 1
  • s

    Sai Vara Prasad

    02/22/2023, 2:14 PM
    hi team, getting this error while running the application, can some one help me on this..
    a
    • 2
    • 1
  • e

    Esa Firman

    02/23/2023, 3:36 AM
    Is there a difference between APK that 1. Created from
    assemble
    task 2. Created from
    bundle
    task and turned into APK with
    bundletools
    g
    e
    • 3
    • 8
  • c

    Colton Idle

    02/24/2023, 7:06 PM
    Joined a project that has these both defined lol. They are the same... right?
    repositories {
        google()
        maven { url '<https://maven.google.com>' }
    }
  • c

    Colton Idle

    02/24/2023, 8:07 PM
    Does anyone know if setting
    android.enableJetifier=true
    even though you don't need it (i.e. all libraries are androidx) will still slow down your build? Like. Does the simple presence of it break incremental compilation?
    n
    t
    • 3
    • 13
  • d

    Deependra Kumar

    02/25/2023, 6:55 PM
    I am getting this error when running react-native on android studio. Can anyone help me out?
    n
    • 2
    • 1
  • t

    TrevJonez

    02/28/2023, 6:44 PM
    I was just about to migrate our internal jacoco-android plugin to be gradle 8 compliant and it has been since the AGP 7.0.1 that I have had to touch it. Makes me wonder. What is the latest most "correct" way to deal with android coverage these days? Is code coverage config still in the DIWhy category?
    • 1
    • 2
  • z

    Zak Taccardi

    02/28/2023, 9:58 PM
    Is there a hidden API/gradle property to hook up
    connectedDebugAndroidTest
    results to gradle build scans? Or do I have to wire the code in a custom way to achieve this?
    t
    d
    • 3
    • 14
  • r

    Raj Bopche

    03/02/2023, 3:03 AM
    What is the preferred way for managing dependency versioning throughout the android project? For ex: Assume I have multiple gradle modules which depends on
    retrofit:2.9.0
    , should I mention this dependency in each module’s build file? What is the best way to manage them centrally?
    n
    • 2
    • 1
  • e

    Esa Firman

    03/03/2023, 12:10 PM
    cross posting for visibility: https://gradle-community.slack.com/archives/CAHSN3LDN/p1677844233891149 Does this mean DependencyResolutionCheck forbid
    project
    to
    module
    (vice versa) substitution?
  • t

    TrevJonez

    03/03/2023, 4:36 PM
    I've got a plugin that generates some kotlin code. Following along with the variants api guide from google everything appears to be working except that kotlin and ksp are not seeing my generated outputs.
    variant.sources.kotlin?.addGeneratedSourceDirectory(
      genTask,
      GenSourcesTask::kotlinOutputDirectory
    ) // not being compiled or ran thru KSP
    
    variant.sources.assets?.addGeneratedSourceDirectory(
      genTask,
      GenSourcesTask::assetsOutputDirectory
    ) // assets get picked up and bundle correctly
    Any pro tips from people that have used this API before?
    m
    • 2
    • 26
  • r

    Rohan Maity

    03/08/2023, 10:28 AM
    Hi folks I am having an issue for a dependency which is not being included in release variant but its available in debug variant Its
    androidx.activity:activity:1.2.4
    I checked the tree to identify where its coming from
    androidx.fragment:fragment:1.1.0 -> 1.3.6
    which again comes from
    +--- androidx.appcompat:appcompat:1.1.0 -> 1.2.0
    now When I switch to release variant or build release variant then Its unable to resolve the classes/methods coming from this version but for debug it works We have
    appcompat_version = "1.2.0"
    which is simple
    implementation()
    we use same version for debug and release We also have
    fragment-ktx = 1.2.5
    but that is also used in release and debug
  • a

    Andrea Di Menna

    03/10/2023, 8:43 AM
    Hey there, has any of you having issues with AGP
    enableUnitTestCoverage
    and intermittently failing tasks in a multi-module project running coverage report tasks in parallel? We are seeing frequent exceptions with AGP 7.4.0 like the following
    Caused by: java.io.UncheckedIOException: Unable to generate Jacoco report
      at com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction.execute(JacocoReportTask.kt:272)
      at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
      at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
      at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
      at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
      at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
      at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
      at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
      at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.lambda$execute$0(IsolatedClassloaderWorkerFactory.java:57)
      at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
      at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
      at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
      at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
      at org.gradle.workers.internal.IsolatedClassloaderWorkerFactory$1.execute(IsolatedClassloaderWorkerFactory.java:49)
      at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:212)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
      at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
      at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
      at org.gradle.internal.Factories$1.create(Factories.java:31)
      at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)
      at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
      at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114)
      at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
      at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      ... 5 more
    Caused by: java.util.zip.ZipException: ZipFile closed
      at java.base/java.util.zip.ZipFile.ensureOpenOrZipException(ZipFile.java:944)
      at java.base/java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:1032)
      at java.base/java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:483)
      at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159)
      at java.base/java.io.FilterInputStream.read(FilterInputStream.java:133)
      at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
      at org.jacoco.report.internal.html.resources.Resources.copyResource(Resources.java:130)
      at org.jacoco.report.internal.html.resources.Resources.copyResources(Resources.java:112)
      at org.jacoco.report.html.HTMLFormatter.createVisitor(HTMLFormatter.java:192)
      at com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction$Companion.generateReport(JacocoReportTask.kt:310)
      at com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction.execute(JacocoReportTask.kt:263)
      ... 38 more
    and I suspect the issue might be in using class loader isolation in the worker actions here Do you have any thoughts on this? Thanks
  • e

    Eileen Yau

    03/10/2023, 8:03 PM
    Hey yall! The gradle daemon kept failing intermittently. The stacktrace isn't clear on what is the issue and I cannot reproduce it locally. We have a pipeline that runs a gradle task to do lintchecks. I checked with my infra team to make sure the instance we run on has enough memory which is does.
    ./gradlew -Dorg.gradle.jvmargs=-Xmx6g dependencyBan app:licensee lintAll --stacktrace >> stacktrace.log
    We recently upgrade the AGP plugin to 7.4.1 when this issue has started. We bumped it to 7.4.2. The last few lines of the logs from daemon:
    [2023-03-10T15:54:59Z] ----- Last  20 lines from daemon log file - daemon-430.out.log -----
    [2023-03-10T15:54:59Z] Property 'potential-bugs>DuplicateCaseInWhenExpression' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>MissingWhenCase' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>RedundantElseInWhen' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'style>ForbiddenPublicDataClass' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'formatting>TrailingComma' is deprecated. Rule is split between `TrailingCommaOnCallSite` and `TrailingCommaOnDeclarationSite` now..
    [2023-03-10T15:54:59Z] Property 'style>LibraryCodeMustSpecifyReturnType' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'complexity>ComplexMethod' is deprecated. Rule is renamed to `CyclomaticComplexMethod` to distinguish between Cyclomatic Complexity and Cognitive Complexity.
    [2023-03-10T15:54:59Z] Property 'style>LibraryEntitiesShouldNotBePublic' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>DuplicateCaseInWhenExpression' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>MissingWhenCase' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>RedundantElseInWhen' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] Property 'style>ForbiddenPublicDataClass' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'formatting>TrailingComma' is deprecated. Rule is split between `TrailingCommaOnCallSite` and `TrailingCommaOnDeclarationSite` now..
    [2023-03-10T15:54:59Z] Property 'style>LibraryCodeMustSpecifyReturnType' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'complexity>ComplexMethod' is deprecated. Rule is renamed to `CyclomaticComplexMethod` to distinguish between Cyclomatic Complexity and Cognitive Complexity.
    [2023-03-10T15:54:59Z] Property 'style>LibraryEntitiesShouldNotBePublic' is deprecated. Rule migrated to `libraries` ruleset plugin.
    [2023-03-10T15:54:59Z] Property 'potential-bugs>DuplicateCaseInWhenExpression' is deprecated. Rule deprecated as compiler performs this check by default.
    [2023-03-10T15:54:59Z] e: error: 'default' is an invalid Java enum value name
    [2023-03-10T15:54:59Z] e: error: 'default' is an invalid Java enum value name
    [2023-03-10T15:54:59Z] e: error: 'default' is an invalid Java enum value name
    [2023-03-10T15:54:59Z] ----- End of the daemon log -----
  • c

    Colton Idle

    03/11/2023, 7:29 AM
    Anyone have a favorite goto recipe to copy to run a gradle task in a github action. i.e. I just want to run ./gradlew checkCodeFormat on a gh action but so many code samples are so wildly different. (note: I haven't used gh actions before, but it seems like there'd be something special we have to do with gradle and caching deps, etc?) Does the gradle team maybe provide something already?
    p
    • 2
    • 2
  • n

    night

    03/11/2023, 9:05 AM
    AGP7.4.1 Project import runs in parallel not works AGP 7.4.1 introduce Project import runs in parallel , but when I upgrade AGP 7.0.4 -> 7.2.2, Gradle 7.3.3 -> 7.4.2. I found my sync time or index time of IDE hasn't difference. I wonder is it true, or how could I benchmark it. Test way Delete all build dirs, .gradle dirs, .idea dirs, .cxx dirs ./gradlew --stop invalidate all caches/restart
  • s

    Sergey Boishtyan

    03/15/2023, 5:55 PM
    Hello there. It's expected that minify tasks for buildVariants in one module executes sequentially? https://scans.gradle.com/s/rv7zwylcdpw3s/timeline?details=z562khxmeem4a&amp;page=91&amp;show=successors
    e
    d
    • 3
    • 7
  • d

    Doni

    03/20/2023, 1:37 AM
    Hi, Im using AGP 7.4.2, kotlin 1.8.10, and gradle 8 throw error because my kapt and compileJava using different jvmTarget to fix this i have to change targetJvm to 11:
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    
    kotlinOptions {        
        jvmTarget = JavaVersion.VERSION_11
    }
    Is it safe to use jvmTarget 11 on android? is there any side effect from it like runtime error on random devices that not supporting java 11 ?
    e
    • 2
    • 5
  • e

    Esa Firman

    03/21/2023, 2:51 AM
    Hi Team, I got similar error with the same setup as this reported issue Basically, I tried to create a functional test in my plugin project and the test project use android plugin, you can check the scan for details My plugin use
    build.gradle.kts
    with
    kotlin-dsl
    while the test project use
    build.gradle
    When I run the test, it cannot find
    com.android.build.gradle.LibraryExtension
    class in the classpath, and when I check the
    android
    extension, the class for that extension is
    com.android.build.gradle.LibraryExtension_Decorated
    Why this can happen? Thanks in advance
  • n

    Nuh Koca

    03/21/2023, 11:41 PM
    Hello, We have a following module structure for our project:
    |-- app -> Can depend on any module
    |-- features
      |-- aModule
        |-- impl -> can only depend on public-api
        |-- public-api -> can only depend on public-api
      |-- bModule
        |-- impl -> can only depend on public-api
        |-- public-api -> can only depend on public-api
    Is it possible to have a
    Gradle
    rule in which I would be able to block an
    impl
    module cannot from depending on another
    impl
    module but `public-api`s only?
    e
    • 2
    • 2
Powered by Linen
Title
n

Nuh Koca

03/21/2023, 11:41 PM
Hello, We have a following module structure for our project:
|-- app -> Can depend on any module
|-- features
  |-- aModule
    |-- impl -> can only depend on public-api
    |-- public-api -> can only depend on public-api
  |-- bModule
    |-- impl -> can only depend on public-api
    |-- public-api -> can only depend on public-api
Is it possible to have a
Gradle
rule in which I would be able to block an
impl
module cannot from depending on another
impl
module but `public-api`s only?
e

ephemient

03/21/2023, 11:57 PM
https://github.com/jraska/modules-graph-assert
n

Nuh Koca

03/22/2023, 12:34 AM
Thank you!
View count: 10