I freshly installed Android Studio and created a HelloWorld project. It works fine. But when I tried to build it via commandline gradlew script found in the project directory it first gave me the error that java is not installed.
After installing the java its now giving me the error:
FAILURE: Build failed with an exception.
What went wrong: Could not determine java version from '11.0.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
Following image shows the java version and the command I executed:
Note: I am running it on a Mac with MacOS High Sierra (10.13.6)
This had something to do with my gradle version. I set the version to the latest by going to Project Structure selecting Project from side menu and set the Gradle version to 4.10.2.
Related
`FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Invalid revision: 3.22.1-g37088a8-dirty
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 54s
Invalid revision: 3.22.1-g37088a8-dirty
`
I am using 3.1.2 version of android studio software. gradle version is 4.6. I am getting above error when I going to build the project. I tried change the gradle version to 4.4 too in gradle-wrapper.properties file. But anything didn't work. Can anyone have any solution as well as a reason why this happen?
As well as i have not set gradle in environment >> system variable. Because I thougtht It is installing to project from android studio. (Please tell something if there any wrong)
I am using the command ionic cordova build and I get the following errors and I don't find a clear answer on this. With this error I can not pass the application to android studio
cordova-plugin-androidx-adapter: Processed 14 source files in 635ms
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\andres\AppData\Local\Android\sdk (recommended setting)
ANDROID_HOME=C:\Users\andres\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\andres\AppData\Local\Android\sdk
FAILURE: Build failed with an exception.
What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17.0.4\bin\java.exe
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
Command failed with exit code 1: C:\Program Files\gradle-7.5\bin\gradle.BAT -p C:\Users\andres\Desktop\aplicacion\platforms\android wrapper -b C:\Users\andres\Desktop\aplicacion\platforms\android\wrapper.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
enter image description here
The issue might be with you java version according to the question description.
C:\Program Files\Java\jdk-17.0.4\bin\java.exe
Java 11 is supported for cordova 10+ which allows for the same minimum Android versions as cordova 9. This should now be the preferred solution.
So you need to check your ionic, cordova and java version and set it accordingly.
I hope this helps.
I'm learning React Native and all of sudden my Android build has started to fail. When I type the command 'react-native run-android' the build fails with following error
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
java.lang.NullPointerException (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 1s Could not install the app on the device, read the
error above for details. Make sure you have an Android emulator
running or a device connected and have set up your Android development
environment:
https://facebook.github.io/react-native/docs/getting-started.html
I have closed and re-opened the terminal, emulator, and Android Studio and made sure that the emulator is running before typing the command. But the build still fails. However if I go into Android Studio and click the 'Play' button (Run App), and the build succeeds and my App is displayed on the Android emulator.
I have also tried copying my project to another folder and all of the same errors still occur. Not a pressing issue, more just of an annoyance so if you have any suggestions that'd be great :)
Same error occurs for me when i change gradle version in build.gradle file.
This error of NullPointerException occurs when the version in build.gradle does not match the version installed in your project root folder.
Then change to the same version resolved the error.
I have set the terminal on Android Studio to use WSL, specifically the Ubuntu one. Running builds from the IDE provided buttons works fine for my project. I decided to start using the terminal more and would prefer to run the builds from there, so I tried running
./gradlew tasks
at the root of the project to test out the Gradle I had installed with sdkman in WSL, but I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/mnt/c/Users/Henry-PC/Desktop/DJ-Cloud/C:\Users\Henry-PC\AppData\Local\Android\Sdk' 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 0s
Any ideas as to what is wrong with?
Just had this issue myself, I had a local.properties file that specified an incorrect directory.
After removing it entirely gradle is able to locate the Android SDK using the exported ANDROID_HOME environment variable
I downloaded the Android Studio and trying to build a simple Login Activity. But the Make Project fails with this error.
Environment: Windows 7 64 bit
Gradle:
trouble writing output: java.security.NoSuchAlgorithmException: SHA-1 MessageDigest not available
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':MyApp:dexDebug'.
Running C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2\dx.bat failed. See output
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I have made sure the Gradle zip was downloaded and installed properly
Any hints what else should I check for?
I was using IBM JDK. Switching to Sun/Oracle JDK fixed the problem.