Gradle : Cannot add task ‘:helloFromBuild1′ as a task with that name already exists - gradle

Gradle gives the below error in terminal.
* What went wrong:
A problem occurred evaluating script.
> Cannot add task ':helloFromBuild1' as a task with that name already exists.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

Task name collision may result from improperly importing files. For a better explanation see this article Gradle : Cannot add task ‘:helloFromBuild1’ as a task with that name already exists..
An very small excerpt from the solution in the above mentioned link is below:
Solution :
If you want to import task of both build_1.gradle and build_2.gradle
in build_3.gradle then in a case like above , you can do it only by
importing build_2.gradle in build_3.gradle, since tasks of
build_1.gradle are already included in build_2.gradle.

Related

How can I configuration spring-boot-configuration-processor when I would like to change from KAPT to KSP? I get every time error

Basic problem, kapt is in maintenance mode. So I would like to change to ksp. In theory, it's the equivalent of faster like kapt. The changing option is not clear.
I did:
This was
plugin {
...
kotlin("kapt") version "1.7.20"
...
replaced by
plugin {
...
id("com.google.devtools.ksp") version "1.7.20-1.0.7"
...
}
and there were
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
kapt("org.springframework.boot:spring-boot-configuration-processor")
replaced by
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
ksp("org.springframework.boot:spring-boot-configuration-processor")
So, when I build project I got below error:
> Task :kspKotlin FAILED
e: [ksp] No providers found in processor classpath.
e: Error occurred in KSP, check log for detail
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':kspKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* 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
BUILD FAILED in 829ms
1 actionable task: 1 executed
I've been mining the internet for almost two days, but I still haven't found a solution to this problem. If anyone knows, I will be very happy! :)
KSP is not a direct replacement to kapt. Changing one name to another won't do the trick.
spring-boot-configuration-processor wasn't built to work with KSP, so this line
ksp("org.springframework.boot:spring-boot-configuration-processor")
won't do anything.

how to publish a package to github package registry with gradle

so this is the error it keep saying
A problem was found with the configuration of task ':publishGprPublicationToRegisteryLibRepository' (type 'PublishToMavenRepository').
In plugin 'org.gradle.maven-publish' type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository' property 'credentials.username' doesn't have a configured value.
Try:
Run with --stacktrace option to get the stack trace.
Run with --debug option to get more log output.
Run with --scan to get full insights.```

"Could not find method platform()" after Firestore upgrade for Flutter project

I just upgraded to Firestore 0.14.4 from 0.13.* for my VSCode/Flutter project and am now getting the build errors below.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\projects\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.14.4\android\build.gradle' line: 54
* What went wrong:
A problem occurred evaluating project ':cloud_firestore'.
> Could not find method platform() for arguments [com.google.firebase:firebase-bom:25.12.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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
BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
My build.gradle file has the line classpath 'com.android.tools.build:gradle:3.3.2 which makes me think my gradle needs upgrading? So, I did the usual Google search but it didn't seem straightforward to upgrade gradle (though I'm sure I missed something). Does it sound like I need to upgrade and, if so, how do I do that?

Gradle : Stackoverflow Error

I'm using Gradle in IDEA and got below output.
* What went wrong:
A problem occurred evaluating script.
> java.lang.StackOverflowError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Actually , I was creating cyclic dependency in files which resulted into this.For a better explanation see here.

Android studio build error

Tried to create my first project in android studio, using one of the examples im trying to run the application, but gradle gives me this build error (didnt change one line of code - just trying to run the Empty activity):
Gradle: FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':Passivelocation:packageDebug'.
org.bouncycastle.asn1.ASN1Integer.(J)V
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Ive tried adding info and debug while running the command on with the cli but i cant make much of the output it gives me.
Any suggestions?
I faced the same failure and the problem was with my jdk/jre because some time ago I added the Bouncy Castle Crypto APIs functionality by adding the jar to my jdk/jre path.
I tried a gradle build with a "clean" jdk/jre and problem was solved

Resources