Execution failed for task ':app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library' - java

:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task
:app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library'.
Unable to unzip
'/home/abhinavralhan/Android/Sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/26.0.0-alpha1/animated-vector-drawable-26.0.0-alpha1.aar'
to
'/home/abhinavralhan/.android/build-cache/3640b9dd51da6db8e5ab286317dbd8fc702b33c2/output'
or find the cached output
'/home/abhinavralhan/.android/build-cache/3640b9dd51da6db8e5ab286317dbd8fc702b33c2/output'
using the build cache at '/home/abhinavralhan/.android/build-cache'.
To troubleshoot the issue or learn how to disable the build cache, go
to https://d.android.com/r/tools/build-cache.html. If you are unable
to fix the issue, please file a bug at
https://d.android.com/studio/report-bugs.html.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Above is the error shown in the Gradle console. Don't mark this as duplicate as none of the existing solutions work. I've tried removing cache, downloaded a new SDK but neither of the solutions seem to work. Thanks in advance. If you need build.gradle or any other source file let me know.

This solution works for Ubuntu 14.04 LTS and should work for other versions too.
Within Android Studio goto:
View>Tool Windows>Terminal
Here, run the following command:
./gradlew cleanBuildCache
After the command has executed with a BUILD SUCCESSFUL message, close Android Studio and navigate to:
<YOUR_PATH>/android-studio/bin
Here, from within the terminal, run the studio.sh script with superuser priviliges(this is important).
$ sudo bash studio.sh
That's it. Your Gradle should build successfully now.

Related

Task :react-native-gradle-plugin:compileKotlin FAILED

Task :react-native-gradle-plugin:compileKotlin FAILED
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is
running on a JDK, not JRE.
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 31s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is
running on a JDK, not JRE.
Download and install JDK
you can check this link for more help:
https://github.com/Jire/Charlatano/issues/854
Try:
rm -rf ./node_modules
yarn
npm run android

I can not run anything with gradle [duplicate]

This question already has answers here:
Unable to locate tools.jar
(35 answers)
Closed 2 years ago.
So, I have this problem, and it is that every time I try to run Gradle from Eclipse it gives me this error:
Working Directory: C:\Users\Owen\eclipse-workspace\SimpleMultiplycationProgram\SimpleMultiplycationProgramApp
Gradle user home: C:\Users\Owen\.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 4.3.1
Java Home: C:\Program Files\Java\jre1.8.0_251
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: run
:SimpleMultiplycationProgramApp:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':SimpleMultiplycationProgramApp:compileJava'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_251 contains a valid JDK installation.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
1 actionable task: 1 executed
So, I started trying to fix this but all the stackoverflow questions and tutorials say to do something like running ./gradle biuld it gives me this error (from cmd):
'.' is not recognized as an internal or external command,
operable program or batch file.
`/gradle biuld' gives me:
'/gradle' is not recognized as an internal or external command,
operable program or batch file.
and gradle biuld gives me:
'gradle' is not recognized as an internal or external command,
operable program or batch file.
and C:\Users\Owen.gradle is a folder, so what is going on?
This seems to be about two unrelated problems. For one, you don't seem to have gradle on your PATH, hence why the command is not recognized. And then you're also missing rt.tools. See if this other question helps you solve it. You seem to have downloaded only the JRE and not the JDK.
It appears to me that you are using a JRE instead of JDK. Possible that you pointed $JAVA_HOME environment variable to a JRE when it was meant to be JDK.
To use gradle, if you have a wrapper in your project directory named "gradlew", call it like this: ./gradlew ...
But if you don't have it, you should run the "wrapper" task to generate them.
You can also install gradle instead. But keep in mind it doesn't help with your issue. Take a look at this article for installing gradle.

Can't compile Cocos2d-x project

I've just installed Cocos2d-X and whenever i try to compile newly created project i got the following error.
I tried to uninstall and install java again and nothing changed.
I'm using the following command to compile.
> cocos.py compile -p android --android-studio
And i got the following Error :
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':libcocos2dx'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option
to get more log output.
BUILD FAILED
and sometimes i get this error
> Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
instead of
> javax/xml/bind/annotation/XmlSchema
I had a similar problem. For me uninstalling java 9 and installing java 8 did the trick.
If you are in Android studio you could go to File -> Project Structure and change the JDK Location to wherever you have java 8 installed
From what I understand command line compile doesn't work for android-studio anymore.
Best way is to try install latest android-studio and latest cocos2d-x. Then build apk and test on device...
First time you run android-studio it will download few things. And first compile for a projct will take ages.. but after that everything will be pretty fast

Gradle ignores daemon ignore flag

I'm running Gradle 3.2.1 on MacOS X 10.12.1 installed with brew install gradle, did not set any env variables etc. myself, trying to use the Java 9 EA:
gradle build -Dorg.gradle.java.home=~/jdk-9.jdk/Contents/Home
But the build is failing with
FAILURE: Build failed with an exception.
What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example,
an unrecognized jvm option is used.
From what I know it fails because the daemon is trying to use the maxpermsize JVM option (which is not supported in Java 8+ but in Java 8 it's only a warning).
So I tried to disable the daemon:
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
But gradle build is still trying to start a daemon... I removed ~/.gradle and .gradle in the project directory. Any other ideas?
$ gradle build -Dorg.gradle.daemon=false -Dorg.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html.
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
> Starting Daemon%
Ok so I figured it out, since I'm running my build like this:
gradle build -Dorg.gradle.java.home=~/jdk-9.jdk/Contents/Home
Gradle has to spawn a new thread to use a different Java version than the one pointed to by JAVA_HOME. This is done by spawning a daemon thread (even despite the false option) with that Java version and is failing. The same would happen if I passed JVM args to the build apparently.
The solution is to instead set JAVA_HOME in the terminal export JAVA_HOME=~/jdk-9.jdk/Contents/Home and just run gradle build.
Still doesn't work because the newest Java9 build broke Gradle's reflection but that's a different story.
I am posting this here since it's too big of a comment (but it is for sure not an answer).
If you run your script with --debug you will see the underlying error. I am running this directly via java-9 without setting the JAVA_HOME btw.
I had the same issue a few jdk-9 builds back and tackled it with:
set _JAVA_OPTIONS "-Dsun.reflect.debugModuleAccessChecks=true
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED"
set instead of export because I'm using fish, but should work for bash the same way.
Interestingly enough this still fails with build 153 with this:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module java.base does not "opens java.util" to unnamed module #67080771
But that is specified within _JAVA_OPTIONS. This might be a regression on build 153.

Unable to get the gradle build running on Jenkins and Hudson

I installed the Gradle plugin for Jenkins but when I try to build the above project, I get this error: https://issues.jenkins-ci.org/browse/JENKINS-21653
So I removed Jenkins and installed Hudson. I installed the Gradle plugin for Hudson but Gradle doesn't show up in the build options. So I tried running the build from the command line option that Hudson has, and it gives the following error:
Started by user anonymous java.io.IOException: Failed to mkdirs:
/home/nav/tempHudsonBuild at
hudson.FilePath.mkdirs(FilePath.java:852) at
hudson.model.AbstractProject.checkout(AbstractProject.java:1538) at
hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:610)
at
hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:517)
at hudson.model.Run.run(Run.java:1450) at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at
hudson.model.ResourceController.execute(ResourceController.java:82)
at hudson.model.Executor.run(Executor.java:137) Finished: FAILURE
There's no lack of space or permission issue. I don't understand why these problems are happening. Could anybody help please? I've been struggling to find a solution for this for almost two days now. I'm using this jdk: jdk1.7.0_45 that came with Netbeans and I even tried building using an older Jenkins war (version 1.515), but it still didn't build. I'm on Fedora 20, 64 bit.
Update: The earlier build I tried with Jenkins was on the Windows partition mounted in Linux which could have had some permission problems. But even when I ran it from my Linux home folder, I got this error:
Started by user anonymous Building in workspace
/var/lib/jenkins/jobs/Unite in Linux filesystem/workspace
[workspace] $ /bin/sh -xe /tmp/hudson6360975070832015842.sh
+ /home/navin/git/unite/./gradlew build /tmp/hudson6360975070832015842.sh: line 2:
/home/navin/git/unite/./gradlew: Permission denied Build step
'Execute shell' marked build as failure Collecting metadata...
Metadata collection done. Finished: FAILURE

Categories