Android Gradle dependency compile doesn't work with Java 9 - android-studio

Friends,
I was trying to run gradle command (mentioned below) to resolve dependencies
gradlew -q dependencies app:dependencies --configuration compile
I am using JDK9 and and using gradle 4.4 but when run above mentioned command getting an error.
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
Failed to notify project evaluation listener.
javax/xml/bind/annotation/XmlSchema
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 20s
Please help me on this.

It is an Android SDK problem with Java 9: Failed to run sdkmanager --list (Android SDK) with Java 9

Related

How to fix failing the sync project with Gradle files?

`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)

ionic cordova [ERROR] An error occurred while running subprocess

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.

FAILURE: Build failed with an exception. creating node js apps

I'm using cordova to create apps and when I used the command
cordova build android I got this error through the CLI:
c:\Apps\projeto_1>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Max\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Program Files (x86)\Android\android-sdk
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Starting Daemon
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 7s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
Where:
Script 'C:\Apps\projeto_1\platforms\android\CordovaLib\cordova.gradle' line: 75
What went wrong:
A problem occurred evaluating script.
No usable Android build tools found. Highest 30.x installed version is 29.0.3; minimum version required is 30.0.3.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
Command failed with exit code 1: c:\Apps\projeto_1\platforms\android\gradlew cdvBuildDebug -b c:\Apps\projeto_1\platforms\android\build.gradle
Example of build failure: Build failed with an exception.
Where:
Script 'C:\Apps\projeto_1\platforms\android\CordovaLib\cordova.gradle' line: 75
What went wrong:
A problem occurred evaluating script.
No usable Android build tools found. Highest 30.x installed version is 29.0.3; minimum version required is 30.0.3.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
Command failed with exit code 1: c:\Apps\projeto_1\platforms\android\gradlew cdvBuildDebug -b c:\Apps\projeto_1\platforms\android\build.gradle

IONIC 5 capacitor build android error : Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'

I get the below error when I want to run my ionic app on android studio by using cmd -> ionic capacitor build android
Can teach me how to solve the below errors so that I can run my application on android studio?
Thank You.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
> Failed to query the value of task ':capacitor-android:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
> Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:..\node_modules\#capacitor\android\capacitor\build\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer#2cce4302) before task ':capacitor-android:compileDebugJavaWithJavac' has completed is not supported
* 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
Issue solved by updating the Gradle in Android Studio.
You must set version of Compile Sdk Version and Builds tools Version in File -> Project Structure -> app . set the values and it build self.

Gradle works with Android Studio but cmd script fails

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.

Resources