DavidStrausz commented on pull request #1130:
URL: https://github.com/apache/cordova-android/pull/1130#issuecomment-824749304


   Hi @breautek, I hope it's okay if I add this here, but I can also open a new 
issue if you need one. 
   This causes the requirements check to fail on macOS Big Sur 11.2.3 if custom 
java options (`_JAVA_OPTIONS`) are set.
   
   For reference in my case I set them in `.zshrc` like this:
   
   ```bash
   export _JAVA_OPTIONS="-Xms2048M -Xmx4096M"
   ```
   
   And this is the exact error:
   ```bash
   Checking Java JDK and Android SDK versions
   ANDROID_SDK_ROOT=/Users/username/Library/Android/sdk (recommended setting)
   ANDROID_HOME=undefined (DEPRECATED)
   Requirements check failed for JDK 1.8.x! Detected version: 2048.0.0
   Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
   ```
   
   The reason for this is happening is because in the new implementation you 
are using `javac -version` to get the version, this prints the java options 
before printing the version like this:
   
   ```bash
   Picked up _JAVA_OPTIONS: -Xms2048M -Xmx4096M
   javac 1.8.0_271
   ```
   
   The result is directly checked via semver without sanitizing the output 
first. In the old implementation a regular expression was used to only check 
the relevant parts:
   
   ```js
   const match = /javac\s+([\d.]+)/i.exec(output);
   ```
   
https://github.com/apache/cordova-android/pull/1130/files#diff-0d1afa0d5c88bdb18fbc6ab9ef7fc4bbe10f7047d387bb2964932dbb6eb8c4b7L198
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to