On a mobile project I have android platform added and working all the way through the play store, except I cannot build from within Wappler (builds from android studio work.)
Error received on build:
Building your Cordova Project for android ...
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/Users/pauka/Library/Android/sdk (recommended setting)
ANDROID_HOME=/Users/pauka/Library/Android/sdk (DEPRECATED)
Using Android SDK: /Users/pauka/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app
ERROR: JAVA_HOME is set to an invalid directory: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
But if I go into terminal in wappler, env shows this for JAVA_HOME, which is a valid directory.
Maybe this will help you gentleman? From a working compiling Mobile Project, check.reqs.js is the file (contained within \platforms\android\cordova\lib):
Thanks Dave…took a look around, and I’m still stuck on this.
The end goal here is to get cordova android api level 30+ working as it is now required (rejects builds if not set).
I’ve tried upgrading gradle to 7.2 but get errors.
I’ve tried specifying version 10.1.1 (and also 10.0.1) of cordova platform when adding.
The one constant is the JAVA_HOME error that pops in wappler when doing a system check of Gradle. Because of that error, it tries to install gradle, which then reports is already installed.
$JAVA_HOME reports a valid directory:
bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home: is a directory
but the gradle check attempts an invalid directory:
ERROR: JAVA_HOME is set to an invalid directory: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
From what I've read, this reverts to the previous method of file mode access. It's a little concerning that this is flagged as Insecure, but from what I've read, it is fine. Use at your own discretion.
The sdk version entry just ensure the api target.
Over in Android Studio, you should be prompted to update from gradle 4 to 7 -- go ahead and do this.
Now, back to the JAVA_HOME issue...
The error seems to occur after the build takes place, so I use the wappler build function, and then hop over to Studio in order to run in the emulator or physical device.
Something tells me this story will evolve.
@George Anything you can do here to shed light on these two situations? JAVA_HOME error and needed to revert to FileMode for Android?
In Wappler use the Java SDK to that is installed with Android Studio.
That is why we point the JAVA_HOME to it, during the execution of commands in Wappler.
Don’t you have the JDK installed in the location under Android Studio? Is the path wrong?
Usually it is this path under Android Studio - unless they changed it…
We always use the one under Android Studio to be sure it is always the right JDK as the user may have many other JDK’s installed on the system.
Are you running the latest release of Android Studio @mebeingken, think its called Bumblebee? I’m very reluctant to update as previous updates have caused numerous headaches. I’m looking at a system switch to Linux on one laptop and a fresh install of Windows 10 on a work laptop so will update everything from the bottom up so may well encounter your issues… So interested to hear if you resolve it?
Just fired up an older Mobile Project that previously compiled/built fine but under Wappler 4.2.2 hangs so will have to post a Bug Report on that one. Updating Cordova in the Project breaks it entirely so not sure if Wappler is backward compatible with older Cordova Projects? @GeorgeMaybe I should leave the questions until I get around to the Bug Report…
Have also found that without first removing the Android Platform from the Project and then adding it again any manual build commands such as cordova build anroid --release entered in the terminal fail… Again should probably make a Bug Report on that too… Going through some older Projects to test bits and pieces and hitting a few issues, so sort of gone off on a tangent in this thread so forgive me!
It seems to clear to me that on a MAC, the location of the jdk is now pulled from gradle, so @George can obviously fix that JAVA_HOME issue. But, what do I know.
Seems there is quite a difference between building on Windows and Mac, and their respective tool-sets, configurations etc. Must be a real headache for the team! Thanks for responding Ken, appreciated greatly sir.