apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Warning on import the Android Project to Android Studio (Electric Eel 2022.1.1) #1635

Closed FranGhe closed 9 months ago

FranGhe commented 9 months ago

I have updated Cordova from 11.0.0 to 12.0.0 and the android platform from Android 11 to Android 12

When I make the import project to Android Studio Electric Eel 2022.1.1 I have a warning like this:

Multiple Gradle daemons might be spawned because the Gradle JDK and JAVA_HOME locations are different. Project 'xxx' is using the following JDK location when running Gradle: '/Applications/Android Studio.app/Contents/jbr/Contents/Home' The system environment variable JAVA_HOME is: '/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home' If you dont need to use different paths (or if JAVA_HOME is undefined), you can avoid spawning multiple daemons by setting JAVA_HOME and the JDK location to the same path.

How can I fix it? I need my java 14.0.2

Yes, I can it change it after the import, but I'll be more relaxed if it's automatic... is this a trouble of Cordova CLI, cordova-android or Android Studio?

Screenshot 2023-07-23 alle 17 40 27
breautek commented 9 months ago

I had a look at this and it seems like this option is controlled via a .idea file. I'm not sure what the consequences are if Cordova generated the .idea file.

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
        <option name="testRunner" value="GRADLE" />
        <option name="distributionType" value="DEFAULT_WRAPPED" />
        <option name="externalProjectPath" value="/mnt/data/development/totalpave/experimental/experiment" />
        <option name="gradleHome" value="$PROJECT_DIR$/../../../gradle" />
        <option name="gradleJvm" value="Embedded JDK" /> <!-- this is the line that seems to control that setting in AS -->
        <option name="modules">
          <set>
            <option value="/mnt/data/development/totalpave/experimental/experiment" />
            <option value="/mnt/data/development/totalpave/experimental/experiment/app" />
          </set>
        </option>
      </GradleProjectSettings>
    </option>
  </component>
</project>

These settings are only ever used in AS. E.g. if you do cordova build android, the Android Studio settings are not used. So it might be better for cordova not to muck with this file because if the structure of this file changes, then it would be up to Cordova to make updates accordingly.

FranGhe commented 9 months ago

Thanks for the support... so the suggestion is to open a bug report and wait for a new update?

breautek commented 9 months ago

Duplicate https://github.com/apache/cordova-cli/issues/624