gluonhq / substrate

Create native Java(FX) apps for desktop, mobile and embedded
GNU General Public License v2.0
372 stars 51 forks source link

Android builds fail on GH ubuntu-22.04 runners due to conflicting SDK variables #1237

Open ennerf opened 7 months ago

ennerf commented 7 months ago

Environment:

It looks like the GH runner defines an ANDROID_SDK_ROOT variable that interferes with the ANDROID_HOME variable and breaks the build.

- name: Build & Package Mobile Binary
  run: mvn gluonfx:build gluonfx:package -Pandroid

Log file section:

[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB] * What went wrong:
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB] Could not determine the dependencies of task ':app:lintVitalReportRelease'.
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB] > Several environment variables and/or system properties contain different paths to the SDK.
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   Please correct and use only one way to inject the SDK location.
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   ANDROID_HOME: /home/runner/.gluon/substrate/Android
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   
[Tue Nov 14 15:28:55 UTC 2023][FINE] [SUB]   It is recommended to use ANDROID_HOME as other methods are deprecated

It works when the environment variable is manually set to be the same:

- name: Build & Package Mobile Binary
  env: # overwrite the deprecated SDK_ROOT variable on github runners
    ANDROID_SDK_ROOT: /home/runner/.gluon/substrate/Android
    ANDROID_HOME: /home/runner/.gluon/substrate/Android
  run: mvn gluonfx:build gluonfx:package -Pandroid