Github Actions Android Build Failing

Hi All, I’m trying to get a Android build working in Github Actions. The error I’m getting is;
android
2024-05-03 23:44:09 INFO Sign ./build/android/FKProtocol/FKProtocol.aab
Cause: java.nio.file.NoSuchFileException: android
Here’s my full build script.
Does anyone have a working example ?

    name: Build and Deploy

on:
  push:
    branches:
      - main  # Trigger on pushes to the main branch
  pull_request:
    branches:
      - main

jobs:
  build-android:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      
      - name: Setup Defold
        uses: dapetcu21/setup-defold@v3.0.3
        with:
          version: '1.8.0'  # Ensure you use the version you need

      - name: Set up Java
        uses: actions/setup-java@v2
        with:
          distribution: 'adopt'  # Eclipse Temurin is a popular choice
          java-version: '17.0.11+9'  # Java 11 is commonly used with Android

      - name: Prepare environment
        run: |
          echo "NEW_VERSION_CODE=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
          echo "NEW_VERSION_NAME=1.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV

      - name: Build project for Android
        run: |
          keytool -genkeypair -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -storepass android -keypass android -dname "CN=Android Debug,O=Android,C=US"
          java -jar $BOB --platform armv7-android --variant debug --bundle-output ./build/android --keystore=./debug.keystore --keystore-alias=androiddebugkey --keystore-pass=android --bundle-format=apk --archive resolve build bundle
        env:
          JAVA_HOME: ${{ steps.setup-java.outputs.java-home }}
      - name: ListFiles 
        if: always()
        run: ls -R
      - name: Upload APK
        if: always()
        uses: actions/upload-artifact@v2
        with:
          name: android
          path: build/android/**/*.apk

Can you please provide the full log from the GitHub Actions?

2024-05-04T00:51:32.4648024Z ##[group]Run actions/setup-java@v2
2024-05-04T00:51:32.4648423Z with:
2024-05-04T00:51:32.4648843Z   distribution: adopt
2024-05-04T00:51:32.4649238Z   java-version: 17.0.11+9
2024-05-04T00:51:32.4649556Z   java-package: jdk
2024-05-04T00:51:32.4649973Z   architecture: x64
2024-05-04T00:51:32.4650320Z   check-latest: false
2024-05-04T00:51:32.4650619Z   server-id: github
2024-05-04T00:51:32.4651037Z   server-username: GITHUB_ACTOR
2024-05-04T00:51:32.4651434Z   server-password: GITHUB_TOKEN
2024-05-04T00:51:32.4652018Z   overwrite-settings: true
2024-05-04T00:51:32.4652516Z   job-status: success
2024-05-04T00:51:32.4652853Z env:
2024-05-04T00:51:32.4653238Z   BOB: /home/runner/work/ZKProtocol/ZKProtocol/.defold/bob.jar
2024-05-04T00:51:32.4653798Z ##[endgroup]
2024-05-04T00:51:32.6151153Z Trying to resolve the latest version from remote
2024-05-04T00:51:33.2542639Z Resolved latest version as 17.0.11+9
2024-05-04T00:51:33.2543351Z Trying to download...
2024-05-04T00:51:33.2546081Z Downloading Java 17.0.11+9 (Adopt-Hotspot) from https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.11_9.tar.gz ...
2024-05-04T00:51:34.2366589Z Extracting Java archive...
2024-05-04T00:51:34.2488470Z [command]/usr/bin/tar xz --warning=no-unknown-keyword -C /home/runner/work/_temp/39687b09-4710-43cd-a24a-c59b6e0a1131 -f /home/runner/work/_temp/2b7f3aa5-80ce-4960-b9b0-6e624e1dad48
2024-05-04T00:51:37.7980028Z Java 17.0.11+9 was downloaded
2024-05-04T00:51:37.7980715Z Setting Java 17.0.11+9 as the default
2024-05-04T00:51:37.7990825Z 
2024-05-04T00:51:37.7991229Z Java configuration:
2024-05-04T00:51:37.7991866Z   Distribution: adopt
2024-05-04T00:51:37.7992428Z   Version: 17.0.11+9
2024-05-04T00:51:37.7993624Z   Path: /opt/hostedtoolcache/Java_Adopt_jdk/17.0.11-9/x64
2024-05-04T00:51:37.7994238Z 
2024-05-04T00:51:37.8022848Z Creating settings.xml with server-id: github
2024-05-04T00:51:37.8079793Z Writing to /home/runner/.m2/settings.xml
2024-05-04T00:51:37.8233228Z ##[group]Run echo "NEW_VERSION_CODE=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
2024-05-04T00:51:37.8234148Z e[36;1mecho "NEW_VERSION_CODE=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENVe[0m
2024-05-04T00:51:37.8234955Z e[36;1mecho "NEW_VERSION_NAME=1.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENVe[0m
2024-05-04T00:51:38.5544635Z shell: /usr/bin/bash -e {0}
2024-05-04T00:51:38.5545498Z env:
2024-05-04T00:51:38.5546202Z   BOB: /home/runner/work/ZKProtocol/ZKProtocol/.defold/bob.jar
2024-05-04T00:51:38.5547183Z   JAVA_HOME: /opt/hostedtoolcache/Java_Adopt_jdk/17.0.11-9/x64
2024-05-04T00:51:38.5548178Z ##[endgroup]
2024-05-04T00:51:38.5818695Z ##[group]Run keytool -genkeypair -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -storepass android -keypass android -dname "CN=Android Debug,O=Android,C=US"
2024-05-04T00:51:38.5820648Z e[36;1mkeytool -genkeypair -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -storepass android -keypass android -dname "CN=Android Debug,O=Android,C=US"e[0m
2024-05-04T00:51:38.5822467Z e[36;1mjava -jar $BOB --platform armv7-android --variant debug --bundle-output ./build/android --keystore=./debug.keystore --keystore-alias=androiddebugkey --keystore-pass=android --bundle-format=apk --archive resolve build bundlee[0m
2024-05-04T00:51:38.5872408Z shell: /usr/bin/bash -e {0}
2024-05-04T00:51:38.5872780Z env:
2024-05-04T00:51:38.5873285Z   BOB: /home/runner/work/ZKProtocol/ZKProtocol/.defold/bob.jar
2024-05-04T00:51:38.5873792Z   JAVA_HOME: 
2024-05-04T00:51:38.5874206Z   NEW_VERSION_CODE: 32
2024-05-04T00:51:38.5874687Z   NEW_VERSION_NAME: 1.0.32
2024-05-04T00:51:38.5875003Z ##[endgroup]
2024-05-04T00:51:39.1229443Z Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
2024-05-04T00:51:39.1230698Z 	for: CN=Android Debug, O=Android, C=US
2024-05-04T00:51:39.1965228Z [Storing debug.keystore]
2024-05-04T00:51:39.4383895Z Download archive(s)Downloading 0 archive(s)
2024-05-04T00:51:39.7244456Z Working...Reading classes...2024-05-04 00:51:39 INFO     
2024-05-04T00:51:40.0134342Z  1% ...done!
2024-05-04T00:51:40.2080969Z Cleaning engine... ...done!
2024-05-04T00:51:41.3118501Z Reading tasks... 2147483647% ...done!
2024-05-04T00:51:41.4262172Z Building... 2% 3% 4%2024-05-04 00:51:41 INFO    Compiling assets/SciFi.atlas using profile Default 
2024-05-04T00:51:41.8302950Z  5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20%2024-05-04 00:51:41 INFO    Compiling builtins/graphics/particle_blob.tilesource using profile Default 
2024-05-04T00:51:41.8587228Z  21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33%2024-05-04 00:51:41 INFO    Compiling assets/UI.atlas using profile Default 
2024-05-04T00:51:42.4390924Z  34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73%2024-05-04 00:51:42 INFO    Compiling main/main.atlas using profile Default 
2024-05-04T00:51:42.7374400Z  74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% 99%2024-05-04 00:51:42 INFO    Generating the resource graph 
2024-05-04T00:51:42.7984896Z 2024-05-04 00:51:42 INFO    Generating the resource graph took 0.060000 s 
2024-05-04T00:51:42.7987897Z 2024-05-04 00:51:42 INFO    Creation of the excluded resources list. 
2024-05-04T00:51:42.7990706Z 2024-05-04 00:51:42 INFO    Creation of the excluded resources list took 0.000000 s 
2024-05-04T00:51:42.8010384Z 2024-05-04 00:51:42 INFO    No public or private key for manifest signing set in liveupdate settings or project options, generating keys instead. 
2024-05-04T00:51:42.9234651Z 2024-05-04 00:51:42 INFO    GameProjectBuilder.createArchive 
2024-05-04T00:51:43.0311000Z 2024-05-04 00:51:43 INFO    GameProjectBuilder.createArchive took 0.107000 
2024-05-04T00:51:43.0324013Z 2024-05-04 00:51:43 INFO    buildManifestData begin 
2024-05-04T00:51:43.0356022Z 2024-05-04 00:51:43 INFO    ManifestBuilder.buildManifestData took 0.003000 
2024-05-04T00:51:43.0582080Z 2024-05-04 00:51:43 INFO    Writing the resource graph to json 
2024-05-04T00:51:43.0677553Z 2024-05-04 00:51:43 INFO    Writing the resource graph to json took 0.010000 s 
2024-05-04T00:51:43.0712411Z  ...done!
2024-05-04T00:51:43.4501209Z Bundling...2024-05-04 00:51:43 INFO    Compiling resources from /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/res 
2024-05-04T00:51:43.4508429Z 2024-05-04 00:51:43 INFO    Compiling /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/res/com.defold.android to /tmp/compiled_resources5780061516789275283/com.defold.android 
2024-05-04T00:51:43.4511509Z 2024-05-04 00:51:43 INFO    exec: /tmp/17419354123817334511/aapt2 compile -o /tmp/compiled_resources5780061516789275283/com.defold.android --dir /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/res/com.defold.android 
2024-05-04T00:51:43.4636943Z 2024-05-04 00:51:43 INFO    Compiling /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/res/com.mylab6.fkprotocol to /tmp/compiled_resources5780061516789275283/com.mylab6.fkprotocol 
2024-05-04T00:51:43.4639987Z 2024-05-04 00:51:43 INFO    exec: /tmp/17419354123817334511/aapt2 compile -o /tmp/compiled_resources5780061516789275283/com.mylab6.fkprotocol --dir /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/res/com.mylab6.fkprotocol 
2024-05-04T00:51:43.4671675Z 2024-05-04 00:51:43 INFO    Linking resources from /tmp/compiled_resources5780061516789275283 
2024-05-04T00:51:43.4684414Z 2024-05-04 00:51:43 INFO    exec: /tmp/17419354123817334511/aapt2 link --proto-format -o /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/aab/aapt2/apk/output.apk -I /tmp/17419354123817334511/lib/android.jar --manifest /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/AndroidManifest.xml --auto-add-overlay -R @/home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/aab/compiled_resources.txt 
2024-05-04T00:51:43.6108844Z 2024-05-04 00:51:43 INFO    Creating AAB base.zip 
2024-05-04T00:51:43.6143090Z 2024-05-04 00:51:43 INFO    Copying dex to /tmp/17419354123817334511/lib/classes.dex 
2024-05-04T00:51:43.6389951Z 2024-05-04 00:51:43 INFO    Copying asset /home/runner/work/ZKProtocol/ZKProtocol/build/default/game.projectc to ./build/android/ZKProtocol/aab/base/assets/game.projectc 
2024-05-04T00:51:43.6411595Z 2024-05-04 00:51:43 INFO    Copying asset /home/runner/work/ZKProtocol/ZKProtocol/build/default/game.arci to ./build/android/ZKProtocol/aab/base/assets/game.arci 
2024-05-04T00:51:43.6415193Z 2024-05-04 00:51:43 INFO    Copying asset /home/runner/work/ZKProtocol/ZKProtocol/build/default/game.arcd to ./build/android/ZKProtocol/aab/base/assets/game.arcd 
2024-05-04T00:51:43.6421525Z 2024-05-04 00:51:43 INFO    Copying asset /home/runner/work/ZKProtocol/ZKProtocol/build/default/game.dmanifest to ./build/android/ZKProtocol/aab/base/assets/game.dmanifest 
2024-05-04T00:51:43.6424607Z 2024-05-04 00:51:43 INFO    Copying asset /home/runner/work/ZKProtocol/ZKProtocol/build/default/game.public.der to ./build/android/ZKProtocol/aab/base/assets/game.public.der 
2024-05-04T00:51:43.6427205Z 2024-05-04 00:51:43 INFO    Copying resources to ./build/android/ZKProtocol/aab/base/res 
2024-05-04T00:51:43.6439447Z 2024-05-04 00:51:43 INFO    Copying engine to ./build/android/ZKProtocol/aab/base/lib/armeabi-v7a/libZKProtocol.so 
2024-05-04T00:51:43.6756923Z 2024-05-04 00:51:43 INFO    Copying engine to ./build/android/ZKProtocol/aab/base/lib/arm64-v8a/libZKProtocol.so 
2024-05-04T00:51:43.7327447Z 2024-05-04 00:51:43 INFO    Zipping ./build/android/ZKProtocol/aab/base to ./build/android/ZKProtocol/aab/base.zip 
2024-05-04T00:51:44.1988706Z 2024-05-04 00:51:44 INFO    Creating Android Application Bundle 
2024-05-04T00:51:44.1994616Z 2024-05-04 00:51:44 INFO    exec: /opt/hostedtoolcache/Java_Adopt_jdk/17.0.11-9/x64/bin/java -jar /tmp/17419354123817334511/bundletool-all.jar build-bundle --modules /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/aab/base.zip --output /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/ZKProtocol.aab --config /home/runner/work/ZKProtocol/ZKProtocol/./build/android/ZKProtocol/aab/BundleConfig.json 
2024-05-04T00:51:45.1009377Z 2024-05-04 00:51:45 INFO    Sign ./build/android/ZKProtocol/ZKProtocol.aab 
2024-05-04T00:51:45.1010445Z android
2024-05-04T00:51:45.1010995Z Cause: java.nio.file.NoSuchFileException: android
2024-05-04T00:51:45.1012345Z 2024-05-04 00:51:45 SEVERE  android

This is supposed to be the path to a file containing the keychain password, not the password itself.

Awesome, that fixed it.

Thank you.

Here’s my project , it’s completely open source and I plan on adding builds for other platforms soon !

1 Like