how to configure the gradle? - java

task failed with an exception
i tried to build basic react-native app but the set up was not completed.

Related

Gradle task assembleDebug failed with exit code 1 ERROR?

Finished with error: Gradle task assembleDebug failed with exit code 1Greetings to everyone I am New among you flutter I want to learn, but I get such an error 5 hours in the solution could not reach it how can we solve? there is such a thing previously?
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project ‘android’.
Could not resolve all artifacts for configuration ‘:classpath’.
Could not resolve com.android.tools.build:gradle:3.5.0.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.5.0.
Could not get resource ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom’.
Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom’.
dl.google.com
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
BU�LD FAILED in 6s
This does not look like a Flutter issue (I could be wrong), but rather a Gradle one. The error entails that the Gradle plugin dependency failed, when tried to build the project.
I would suggest to look into what Gradle version you are using to build your project and see the compatible version of Gradle Plugin for that.

How can I disable IntelliJ using the Gradle run task to run my code?

After updating IDEA, every time I debug a class in a new project only, it seems to be using the Gradle run task to run my code (despite using an "Application" run configuration, not "Gradle"!):
6:40:27 AM: Executing task 'Test.main()'...
Connected to the target VM, address: '127.0.0.1:49580', transport: 'socket'
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
Connected to the VM started by ':Test.main()' (localhost:49597). Open the debugger session tab
> Task :Test.main()
test
This is causing me many problems.
If I run tasks in an old project, it will just compile and run the code directly, without using Gradle. I compared all the settings in the two run configurations, and they're identical.
How can I disable this and prevent IntelliJ from creating this kind of run configuration when I just want a regular run configuration?
In IntelliJ-IDEA 2019 the option was moved directly to Gradle Settings (Build, Execution, Deployment -> Build Tools -> Gradle):
Run tests using: Gradle / IntelliJ IDEA
2022 Solution
Basically, your intellij is building the project by running the gradle task everytime you run even a simple Application(a class having main method).
For the changing the setting that running main method should not build the project or basically run the gradle task.
In IntelliJ IDEA 2022 version:
IntelliJ IDEA => Preferences => Search gradle => Go to Gradle => Select Gradle for Build and run using: and Run tests using: as shown below:
Please remember to build or run gradle task separately in case when you update/change your build.gradle.

Unable to build and run imported project with Connection refused and Gradle errors

I was trying to clone this repository from github:
https://github.com/ziakhalid/spring-rest-sample.git
which i then imported project from external model (gradle) and using this project configurations
the building result was a connection refused error message together with sync failed and error in run build and configure build
when i probe in the error of run build this was the list of gradle error message
and the same goes to configure build, the error list here
**i have tried refreshing my gradle without any result and adding gradle under the gradle tab
which feedbacks to me that the project is already registered.**

Jenkins can't build apk "Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'."

I'm new to Jenkins. I want to build apk using Jenkins but it failed due to this error:
What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
Could not resolve project :library.
Required by:
project :app
Unable to find a matching configuration of project :library: None of the consumable configurations have attributes.
I'm always getting this error whenever I set/specify the task at Invoke Gradle on Build section.
screenshot of Invoke Gradle fields
When I empty that "Task" field, the build status will SUCCESS but there's no build file stored on my workspace.
Fyi, I'm using:
Windows 10,
Gradle 4.1.,
JDK 8u152
Thanks!
Update:
I just notice that this error (exactly same) also happens on my Android Studio.
#bongo
This is the contents of my root folder:
contents of root folder

Spring boot application local build passes, but fails in Jenkins due to Tests

When executing gradle build command in local system for xxxx-app, the build is successful. But When I execute the build through Jenkins job, the build gets fails when executing the Spring boot application Tests as shown below.
:xxxx-app:processTestResources UP-TO-DATE
:xxxx-app:testClasses
:xxxx-app:test
com.xxxx.yyyy.XXXXApplicationTests > contextLoads FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: java.lang.IllegalArgumentException
1 test completed, 1 failed
:xxxx-app:test FAILED
FAILURE: Build failed with an exception.
I believe this is something to do with test dependencies in build.gradle, But not sure the same is getting successful in local system. I am using below dependency,
testCompile('org.springframework.boot:spring-boot-starter-test')
Can some one help on this issue due to this I could not proceed further in Jenkins job?
I was facing the same issue. In my case, it was an issue with test failures in old Jenkins builds. You will need to add gradle clean before gradle test.
Look at this answer for explanation when do we need to do gradle clean.

Categories

Resources