problem with creating my first HelloWorld app on android studio - java

these are the errors I receive;
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\AndyKhayaMhlanga\.gradle\daemon\helloWorld3\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.
> com/android/ide/common/blame/MessageReceiver
* 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
CONFIGURE FAILED in 9s
ERROR: Unable to load class 'com.android.ide.common.blame.MessageReceiver'.
Possible causes for this unexpected error include:
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.

You can try some of the things it's suggesting. I would start with syncing Gradle again: in Android Studio, do File -> Sync Project with Gradle Files
This will make sure all dependencies download.

I do believe when you launch a new app Android Studio automatically a TextView saying, "Hello, World" in the center. I this what you want to accomplish?
If not, this has happened to me before perhaps going back to the first version or starting over would help. If you start over go step by step first the layout then snippets of code. And when it doesn't work you'll know what is wrong.
Hope this helps!

Related

LibGDX gives a gradle error when I try and build my game

Im trying to build my LibGDX game with the command
./gradlew desktop:dist
but it keeps giving this error
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :core:compileJava
Note: E:\Programming\Java\LIBGdx\TextGame\core\src\com\imjustdoom\textgame\stage\PlayGame.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :desktop:dist FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':desktop:dist'.
> Cannot expand ZIP 'E:\Programming\Java\LIBGdx\TextGame\core\build\libs\core-1.0.jar' as it does not exist.
* 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 12s
5 actionable tasks: 4 executed, 1 up-to-date
I am using intelliJ and Java 11 if that matters
I have tried running ./gradlew clean but that didnt help
Im trying to build for desktop
What plugin do you use?
I mean from which plugin does dist task come from? Or is this a custom task?
compileJava task won't produce any artifact like jar file for you, it will only generate class files.
First you have to execute gradlew build that contains assebmle task or gradlew assebmle directly so that jar will be generated in build\libs\ and only after that run gradlew desktop:dist
It's also a question how projects are structured. I see compilation is done on core project, then dist is failing on desktop one, maybe here there is another issue.
So the answer seemed to be downgrading gradlew to 6.7 using. Mustve defaulted to gradle 7 for some reason
./gradlew wrapper --gradle-version 6.7

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.

Gradle build always fails on different projects

I am trying to build Gradle projects. Installed Gradle's latest version (6.0.1) using Homebrew. When I try gradle build in various projects (for example https://github.com/arnabmitra/trustlines-demo), it gives this error:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
> org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String, org.gradle.api.internal.file.FileResolver, org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)
* 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 1m 25s
Similar errors happened with other projects. It's my first time using Gradle (come from Maven) and what I am trying to do is just compile the project to have .class files.
Don't use your installation of gradle. Use ./gradlew. That will automatically download and use the version of gradle that the project uses, instead of an incompatible version.
See https://docs.gradle.org/current/userguide/gradle_wrapper.html
If you are using Kotlin 1.3.10, update Kotlin to at least 1.3.20.
Issue was that Kotlin 1.3.10 uses the DefaultSourceDirectorySet constructor via reflection which has been removed in Gradle 6: https://discuss.gradle.org/t/the-defaultsourcedirectoryset-constructor-has-been-deprecated/29610

Gradle Build Can't Find testSrcDirs

I'm trying to run a Gradle build for an existing Java project, but I get the following error that appears to be unrelated to my project.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myProject:test'.
> Could not get unknown property 'testSrcDirs' for task ':myProject:test' of type org.gradle.api.tasks.testing.Test.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
How can I fix this error?
If you land on this page searching for the testSrcDir exception, try updating the gradle clover plugin jar from 2.0.1 to latest versions.
If can't update the version you could also try the workaround suggested here
test {
ext.testSrcDirs = project.sourceSets.test.java.srcDirs
}
For me, the issue was that my project needed to be built with Gradle 2.x but I was using Gradle 3.x. Once I reverted my Gradle version, the build worked.

Project Modules broken after import/open a project (Task generateDebugSources not found)

I'm starting with AndroidStudio and I getting an error when trying to export the project into the version control:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task 'generateDebugSources' not found in project ':app'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get
the stacktrace. Run with --info or --debug option to get more log output.
The steps to reproduce are:
Create a new project
Import the project into the SVN server, excluding the files in the .gitignore:
The folder .gradle
The file .idea/workspace.xml
The file local.properties
The folder .idea/libraries
The folders build
Checkout the project from the version control, in AndroidStudio select File/Open.. and open the exported project
How can I solve that?
In my case, I got this error when I tried to open a project originally created with Eclipse & ADT.
To solve it, try to "export" gradle files from Eclipse and then import it to Android studio (which crashed when I tried to do so but that's another story). If this is your case as well, please see this link:
http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects
I detected the problem:
Adding the .gradle recursivelly also ignored the file app/build.gradle file, breaking the compilation process

Categories

Resources