I was Adobe Phonegap Build user/developer
Now trying Cordova CLI to a sample project, but getting errors, can you debug… below…?
Also, you can give Docs URLs to read more… ?
PS C:\Users\User\PhpstormProjects\Cordova> gradle -v
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------
Build time: 2023-10-04 20:52:13 UTC
Revision: e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f
Kotlin: 1.9.10
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21 (Oracle Corporation 21+35-LTS-2513)
OS: Windows 11 10.0 amd64
PS C:\Users\User\PhpstormProjects\Cordova> cordova create PolisCyprusApp org.polischrysochous.polis "Polis Cyprus"
Creating a new cordova project.
PS C:\Users\User\PhpstormProjects\Cordova> cd .\PolisCyprusApp\
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> gradle -v
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------
Build time: 2023-10-04 20:52:13 UTC
Revision: e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f
Kotlin: 1.9.10
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21 (Oracle Corporation 21+35-LTS-2513)
OS: Windows 11 10.0 amd64
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> cordova requirements
No platforms added to this project. Please use `cordova platform add <platform>`.
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> cordova platform ls
Installed platforms:
Available platforms:
android
browser
electron
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> cordova platform add android
Using cordova-fetch for cordova-android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: org.polischrysochous.polis
Name: Polis Cyprus
Activity: MainActivity
Android Target SDK: android-33
Android Compile SDK: 33
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@12.0.1
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> cordova requirements
Requirements check results for android:
Java JDK: installed 21.0.0
Android SDK: installed true
Android target: installed android-34,android-33
Gradle: installed C:\Gradle\gradle-8.4\bin\gradle.BAT
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\User\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: C:\Users\User\AppData\Local\Android\Sdk
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp\platforms\android\settings.gradle' (C:\Users\User\.gradle\caches\7.6\scripts\dqjrgsw17c62wbpoagod92e1e).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65
* 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.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
Command failed with exit code 1: C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp\platforms\android\gradlew -b C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp\platforms\android\build.gradle cdvBuildDebug
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp> gradle --version
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------
Build time: 2023-10-04 20:52:13 UTC
Revision: e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f
Kotlin: 1.9.10
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21 (Oracle Corporation 21+35-LTS-2513)
OS: Windows 11 10.0 amd64
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp>
in this PC Having PHPStorm 2023.2 and Android Studio
the CLI EXTRACT Above is from PHPStorm…
Android Studio Giraffe | 2022.3.1 Patch 2
Build #AI-223.8836.35.2231.10811636, built on September 14, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 4
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
[1] refers to using the toolchains feature [2] refers to running Gradle itself.
In your case the problem is about running Gradle.
So when using Java 20 to run Gradle, you can use Gradle 8.3 or 8.4 but nothing earlier.
And actually, you should not install any Gradle version at all.
Each Gradle build should imho contain the 4 Gradle wrapper files and you should always use the Gradle wrapper to execute a build. The wrapper will take care to use the exact version of Gradle that the build was designed for and is known working with.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\User\PhpstormProjects\Cordova\PolisApp> cd ..\PolisCyprusApp2\
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\User\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: C:\Users\User\AppData\Local\Android\Sdk
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2\platforms\android\settings.gradle' (C:\Users\User\.gradle\caches\7.6\scripts\dqjrgsw17c62wbpoagod92e1e).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
* 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.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 10s
Command failed with exit code 1: C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2\platforms\android\gradlew -b C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2\platforms\android\build.gradle cdvBuildDebug
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2>
If that directory is undeletable, then it is as the message says, something is locking those files.
Quite the Gradle daemon, and quit your IDE.
If it still is not deletable, reboot your computer, or use some tool like “ProcessExplorer” or “handle” where you can lookup which process locks specific files.
How to disable + uninstall + never-Appear 7.6 Gradle…?
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp2> cd ..
PS C:\Users\User\PhpstormProjects\Cordova> cordova create PolisCyprusApp3 org.polischrysochous.polis "Polis Cyprus"
Creating a new cordova project.
PS C:\Users\User\PhpstormProjects\Cordova> cd ..\PolisCyprusApp3\
cd : Cannot find path 'C:\Users\User\PhpstormProjects\PolisCyprusApp3\' because it does not exist.
At line:1 char:1
+ cd ..\PolisCyprusApp3\
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\User\P...olisCyprusApp3\:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS C:\Users\User\PhpstormProjects\Cordova> cd PolisCyprusApp3\
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova requirements
No platforms added to this project. Please use `cordova platform add <platform>`.
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova platform ls
Installed platforms:
Available platforms:
android
browser
electron
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova platform add android
Using cordova-fetch for cordova-android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: org.polischrysochous.polis
Name: Polis Cyprus
Activity: MainActivity
Android Target SDK: android-33
Android Compile SDK: 33
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@12.0.1
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova platform ls
Installed platforms:
android 12.0.1
Available platforms:
browser
electron
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova requirements
Requirements check results for android:
Java JDK: installed 20.0.2
Android SDK: installed true
Android target: installed android-34,android-33
Gradle: installed C:\Gradle\gradle-8.4\bin\gradle.BAT
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\User\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: C:\Users\User\AppData\Local\Android\Sdk
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details
* 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.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 11s
Command failed with exit code 1: C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3\platforms\android\gradlew -b C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3\platforms\android\build.gradle cdvBuildDebug
PS C:\Users\User\PhpstormProjects\Cordova\PolisCyprusApp3>
Whether it is installed or not is not really relevant.
You should always use the Gradle wrapper to run a build.
And the Gradle wrapper uses the Gradle version that is defined in the wrapper files for that build.
If you run a build that define 7.6, 7.6 is automatically downloaded and used if necessary.
Which Gradle version are “installed” is not important.
I usually do not have any Gradle version installed, as each sane build should have the 4 Gradle wrapper files and thus do not need any installed Gradle version.
About,
“If you run a build that define 7.6, 7.6 is automatically downloaded and used if necessary.
Which Gradle version are “installed” is not important.”
Can you provide URLs about testing/compiling a Cordova CLI App [first time - was user build.phonegap by Adobe.com]… When I created a new Cordova Project, and again had Gradle 7.6 errors…
What to do in my case…? or tell me URLs from scratch installation, in a Windows 11 Pro VM with all tools, but NOT AGAIN HAVING Gradle 7.6 errors… WELL???
I appreciate your support,
Cordova API is a framework that uses web tech [HTML5/CSS3/JS] to build hybrid mobile apps for Android/iPhone/iPad, like Adobe PhoneGap Build or Ionic.
well at:
As I said, I never install any Gradle version anywhere.
The Gradle wrapper defines which Gradle version to use for executing that specific build and should be included in every sane build.
So to run a Gradle build you do not need any Gradle version installed, just a compatible Java version for the Gradle version you want to run.