breautek commented on issue #624:
URL: https://github.com/apache/cordova-cli/issues/624#issuecomment-1665458077

   As hinted by my comment on your other ticket: 
https://github.com/apache/cordova-android/issues/1635#issuecomment-1650298446
   
   The option is controlled via the `.idea` file, which is a configuration file 
specific to Android Studio (It being an IDEA IDE). If I'm interpreting the 
message correctly, you're getting the warning because Android Studio expects 
that your Gradle JDK should match the system `JAVA_HOME` variable.
   
   > is this a trouble of Cordova CLI, cordova-android or Android Studio?
   
   Cordova doesn't actually use android studio really, it only uses the Android 
SDK. These are two different products. I eel like it probably would be best to 
keep Cordova decoupled from the IDE otherwise that might be another dependency 
that needs to be managed, and the IDE is something that changes nearly annually 
if not more frequent. It's a high risk of a breaking change from occurring 
without any heads up or ability to actually control the dependency.
   
   > How can I fix it? I need to use my java 14.0.2 installed on PC
   
   Cordova-android@12 while still uses AGP version that expects JDK 11, a JDK 
version up to 17 should work. So the answer is you'll need to configure Android 
Studio to use your system JDK, if you absolutely require JDK 14 for other 
things. This can probably automated via a 
[after_platform_add](https://cordova.apache.org/docs/en/11.x/guide/appdev/hooks/index.html)
 hook. I don't think the file will exist at all after platform add. It's likely 
created once you open up Android Studio, but you should be able to take a copy 
of your file and provide it manually so that when you do open up android 
studio, the configuration file is read and AS should be configured they want 
you want it.
   
   Note that the configuration file does have some absolute paths stored, so if 
you work in a team with developers on different machines, you may need to also 
template out those settings so that you can provide the absolute path 
dynamically
   
   Note for cordova-android@11 users, cordova-android@11 uses an AGP version 
that expects a JDK version no higher than 11. Therefore if you require a system 
JDK higher than 11, unfortunately you'll be stuck with the warning unless if 
you can update to cordova-android@12. .
   
   I'm closing this because it isn't a bug with Cordova. If you have further 
questions on how to use hooks, then the best place for community support is via 
[Apache Cordova Discussions](https://github.com/apache/cordova/discussions).


-- 
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.

To unsubscribe, e-mail: [email protected]

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