[GH-ISSUE #1172] Issue: SDK location not found Android build #653

Closed
opened 2026-03-01 21:45:15 +03:00 by kerem · 10 comments
Owner

Originally created by @cinder92 on GitHub (May 18, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1172

System information

  • Operating System: macOS
  • Architecture: 64 bit
  • Apple M1: no
  • Docker version: Docker version 20.10.14, build a224086
  • Docker image used in act: nektos/act-environments-ubuntu:18.04
  • act version: 0.2.26

Expected behaviour

Build android apk successfully

Actual behaviour

SDK not found

Workflow and/or repository

name: Android Build ## name of the workflow
on: push

jobs:
  android-build:
    name: Android Build
    runs-on: ubuntu-latest # using ubuntu latest version / or you can use a specific version

    steps:
      - name: Check out Git repository # clone the repo to local ci workspace
        uses: actions/checkout@v2
      
      - name: Set up Node 14
        uses: actions/setup-node@v3
        with:
          node-version: 14

      - name: Set up our JDK environment # setup JDK environment: mandatory as we need to build  android project
        uses: actions/setup-java@v1.4.3
        with:
          java-version: 11

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - name: Restore node_modules from cache
        uses: actions/cache@v2
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Install dependencies # install project deps with --frozen-lockfile to make sure we will have the same packages version ( very recommended  on running yarn install on ci)
        run: yarn install --frozen-lockfile

      ## configure cash for gradle : will help to reduce build time
      - name: Cache Gradle Wrapper
        uses: actions/cache@v2
        with:
          path: ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

      - name: Cache Gradle Dependencies
        uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
          restore-keys: |
            ${{ runner.os }}-gradle-caches-

      - name: Make Gradlew Executable
        run: cd android && chmod +x ./gradlew

      - name: Generate App APK
        run: |
          cd android && ./gradlew assembleRelease --no-daemon

      ## sign generated apk
      - name: Sign APK
        id: sign_app
        uses: r0adkll/sign-android-release@v1
        with:
          releaseDirectory: android/app/build/outputs/apk/release
          signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
          alias: ${{ secrets.ANDROID_ALIAS }}
          keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
          keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}

Steps to reproduce

run act --env-file .env -P ubuntu-latest=nektos/act-environments-ubuntu:18.04

act output

 * What went wrong:
| Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
| > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/react-native/android/local.properties'.
Originally created by @cinder92 on GitHub (May 18, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1172 ## System information - Operating System: macOS - Architecture: 64 bit - Apple M1: no - Docker version: Docker version 20.10.14, build a224086 - Docker image used in `act`: nektos/act-environments-ubuntu:18.04 - `act` version: 0.2.26 ## Expected behaviour Build android apk successfully ## Actual behaviour SDK not found ## Workflow and/or repository ``` name: Android Build ## name of the workflow on: push jobs: android-build: name: Android Build runs-on: ubuntu-latest # using ubuntu latest version / or you can use a specific version steps: - name: Check out Git repository # clone the repo to local ci workspace uses: actions/checkout@v2 - name: Set up Node 14 uses: actions/setup-node@v3 with: node-version: 14 - name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project uses: actions/setup-java@v1.4.3 with: java-version: 11 - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Restore node_modules from cache uses: actions/cache@v2 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install dependencies # install project deps with --frozen-lockfile to make sure we will have the same packages version ( very recommended on running yarn install on ci) run: yarn install --frozen-lockfile ## configure cash for gradle : will help to reduce build time - name: Cache Gradle Wrapper uses: actions/cache@v2 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - name: Cache Gradle Dependencies uses: actions/cache@v2 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle-caches- - name: Make Gradlew Executable run: cd android && chmod +x ./gradlew - name: Generate App APK run: | cd android && ./gradlew assembleRelease --no-daemon ## sign generated apk - name: Sign APK id: sign_app uses: r0adkll/sign-android-release@v1 with: releaseDirectory: android/app/build/outputs/apk/release signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} alias: ${{ secrets.ANDROID_ALIAS }} keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} ``` ## Steps to reproduce run `act --env-file .env -P ubuntu-latest=nektos/act-environments-ubuntu:18.04` ## `act` output ``` * What went wrong: | Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'. | > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/react-native/android/local.properties'. ```
kerem 2026-03-01 21:45:15 +03:00
Author
Owner

@catthehacker commented on GitHub (May 21, 2022):

Did you install Android SDK?

<!-- gh-comment-id:1133478922 --> @catthehacker commented on GitHub (May 21, 2022): Did you install Android SDK?
Author
Owner

@github-actions[bot] commented on GitHub (Jun 21, 2022):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1160974688 --> @github-actions[bot] commented on GitHub (Jun 21, 2022): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@PrasannaKumarChalla commented on GitHub (Dec 9, 2022):

@catthehacker I'm running into the same issue, when you asked did you install android sdk here https://github.com/nektos/act/issues/1172#issuecomment-1133478922, where should I install android sdk?. Doesn't ubuntu-latest come with android sdk by default?.

<!-- gh-comment-id:1344597192 --> @PrasannaKumarChalla commented on GitHub (Dec 9, 2022): @catthehacker I'm running into the same issue, when you asked did you install android sdk here https://github.com/nektos/act/issues/1172#issuecomment-1133478922, where should I install android sdk?. Doesn't ubuntu-latest come with android sdk by default?.
Author
Owner

@deepraj02 commented on GitHub (Apr 1, 2023):

Any Update guys I'm also getting the same error

<!-- gh-comment-id:1492868038 --> @deepraj02 commented on GitHub (Apr 1, 2023): Any Update guys I'm also getting the same error
Author
Owner

@axstel commented on GitHub (Jun 14, 2023):

Same here, any update?

<!-- gh-comment-id:1590992082 --> @axstel commented on GitHub (Jun 14, 2023): Same here, any update?
Author
Owner

@maxfie1d commented on GitHub (Aug 7, 2023):

Any update?

<!-- gh-comment-id:1667370196 --> @maxfie1d commented on GitHub (Aug 7, 2023): Any update?
Author
Owner

@andylvua commented on GitHub (Aug 30, 2023):

I had the same problem as the author.

It looks like even the catthehacker/ubuntu:full images don't provide the Android SDK like the GitHub runners do.

As a temporary solution, you can add the following step to your workflow:

  - name: Set up Android SDK
    if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu
    uses: android-actions/setup-android@v2

It will only run when using act locally and will install the Android SDK. After that Gradle works without errors. No additional actions are required

<!-- gh-comment-id:1699598124 --> @andylvua commented on GitHub (Aug 30, 2023): I had the same problem as the author. It looks like even the `catthehacker/ubuntu:full` images don't provide the Android SDK like the GitHub runners do. As a **temporary solution**, you can add the following step to your workflow: ```YAML - name: Set up Android SDK if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu uses: android-actions/setup-android@v2 ``` It will only run when using `act` locally and will install the Android SDK. After that Gradle works without errors. No additional actions are required
Author
Owner

@ChristopherHX commented on GitHub (Aug 30, 2023):

The following is outdated catthehacker/ubuntu:full, I consider to replace it with https://github.com/ChristopherHX/runner-image-blobs/pkgs/container/runner-images/122920815?tag=ubuntu22-runner-usr-local-opt-snap-20230821.1.0 (Experimental, dump of ubuntu-22.04 vm)
Prepare to have 80GB+ Storage (ca. 20GB gzip layers).

I have dumped the docker image by manually uploading tar layers to the registry, because GitHub Hosted Runners can not even pull the image via docker (due to it's size).

Then you have really 99% of the same filesystem as on GitHub Hosted Runners (maybe some stuff doesn't work in a docker container, however a script might be able to create a lxd vm etc.).

<!-- gh-comment-id:1699625943 --> @ChristopherHX commented on GitHub (Aug 30, 2023): The following is outdated `catthehacker/ubuntu:full`, I consider to replace it with https://github.com/ChristopherHX/runner-image-blobs/pkgs/container/runner-images/122920815?tag=ubuntu22-runner-usr-local-opt-snap-20230821.1.0 (Experimental, dump of ubuntu-22.04 vm) Prepare to have 80GB+ Storage (ca. 20GB gzip layers). I have dumped the docker image by manually uploading tar layers to the registry, because GitHub Hosted Runners can not even pull the image via docker (due to it's size). Then you have really 99% of the same filesystem as on GitHub Hosted Runners (maybe some stuff doesn't work in a docker container, however a script might be able to create a lxd vm etc.).
Author
Owner

@andylvua commented on GitHub (Aug 30, 2023):

The following is outdated catthehacker/ubuntu:full, I consider to replace it with https://github.com/ChristopherHX/runner-image-blobs/pkgs/container/runner-images/122920815?tag=ubuntu22-runner-usr-local-opt-snap-20230821.1.0 (Experimental, dump of ubuntu-22.04 vm) Prepare to have 80GB+ Storage (ca. 20GB gzip layers).

Totally agree. However, if the issue is caused by Android SDK only, then catthehacker/ubuntu:act-22.04 with an additionally installed SDK is sufficient. I referred to catthehacker/ubuntu:full because it's the default image used when you select Large image on the first run.

<!-- gh-comment-id:1699682210 --> @andylvua commented on GitHub (Aug 30, 2023): > The following is outdated `catthehacker/ubuntu:full`, I consider to replace it with https://github.com/ChristopherHX/runner-image-blobs/pkgs/container/runner-images/122920815?tag=ubuntu22-runner-usr-local-opt-snap-20230821.1.0 (Experimental, dump of ubuntu-22.04 vm) Prepare to have 80GB+ Storage (ca. 20GB gzip layers). Totally agree. However, if the issue is caused by Android SDK only, then `catthehacker/ubuntu:act-22.04` with an additionally installed SDK is sufficient. I referred to `catthehacker/ubuntu:full` because it's the default image used when you select `Large` image on the first run.
Author
Owner

@tmo1 commented on GitHub (Mar 11, 2025):

I'm hitting this problem as well. @andylvua's "temporary solution" works for me, but it's kludgy. If there's no better solution, shouldn't this issue remain open?

<!-- gh-comment-id:2712446498 --> @tmo1 commented on GitHub (Mar 11, 2025): I'm hitting this problem as well. [@andylvua's "temporary solution"](https://github.com/nektos/act/issues/1172#issuecomment-1699598124) works for me, but it's kludgy. If there's no better solution, shouldn't this issue remain open?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#653
No description provided.