gluonhq / hello-gluon-ci

HelloGluon sample including Github actions for automating builds and releases
Other
32 stars 40 forks source link

Android build is broken due to changed Github Actions OS Image #17

Closed FlorianKirmaier closed 2 years ago

FlorianKirmaier commented 2 years ago

@johanvos @jperedadnr

The Android build no longer works since ... Today.

It's indepdendent of the.project. I think it due to the change of the default NDK from 21 to 25 on the 1. Auguest https://github.com/actions/virtual-environments/issues/5930

Here is a link to a failing build: https://github.com/FlorianKirmaier/hello-gluon-ci-test-browser/runs/7652185424?check_suite_focus=true

At the end i get the following exception:

[Wed Aug 03 12:49:01 UTC 2022][INFO] We will now compile your code for aarch64-linux-android. This may take some time.
java.io.IOException: You specified an android NDK, but it doesn't contain /usr/local/lib/android/sdk/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/objdump
    at com.gluonhq.substrate.target.AndroidTargetConfiguration.compile(AndroidTargetConfiguration.java:124)
    at com.gluonhq.substrate.SubstrateDispatcher.nativeCompile(SubstrateDispatcher.java:425)
    at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:54)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

Adding the following Statement to the github actions build didn't fix it:

      - name: Install NDK 21
        run: |
          ANDROID_ROOT=/usr/local/lib/android
          ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
          SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
          echo "y" | $SDKMANAGER "ndk;21.4.7075529"
FlorianKirmaier commented 2 years ago

The following workaround seems to fix the issue:

      - name: Install NDK 21
        run: |
          ANDROID_ROOT=/usr/local/lib/android
          ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
          SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
          echo "y" | $SDKMANAGER "ndk;21.4.7075529"
          echo 'ANDROID_NDK=/usr/local/lib/android/sdk/ndk/21.4.7075529' >> $GITHUB_ENV
          echo 'ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/21.4.7075529' >> $GITHUB_ENV
          echo 'ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/21.4.7075529' >> $GITHUB_ENV
          echo 'ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/21.4.7075529' >> $GITHUB_ENV
jperedadnr commented 2 years ago

We fixed this issue on Attach yesterday, which is built on macOS 11, which still has NDK 21.4: https://github.com/gluonhq/attach/blob/master/.github/workflows/build.yml#L33

Ubuntu 20.04, however, might not have it: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#android

We could use your patch, which seems fine, but that would only help for this Hello Gluon CI case. However, we could fix this issue in Substrate though, which is the one installing the default NDK after all (which now is 25), as this affects anyone locally that builds for Android without NDK installed yet.

jperedadnr commented 2 years ago

Okay, I've removed my Android folder and reinstalled it with Substrate, it seems idk-bundle still works, and it downloads 22.1.7171670, which then works fine to build an Android APK. So nothing to fix on Substrate.

I've also reviewed the logs from the GitHub action, and while it downloads the whole Android packages, it doesn't download the Android NDK, because ANDROID_NDK is already set (now to 25).

So we could try:

I haven't tested that one yet, hopefully it will still work

jperedadnr commented 2 years ago

Fixed with Substrate release and plugin 1.0.15