Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would you know why emulator shows error: Not enough space to create userdata partition #76

Open
poponuts opened this issue Aug 29, 2024 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@poponuts
Copy link

poponuts commented Aug 29, 2024

Question

I was following your CI steps with the following snippet:

      - name: Get Device Name
        id: device
        run: |
          AVD_NAME=$(node -p "require('./.detoxrc').devices.emulator.device.avdName")
          echo "AVD_NAME=$AVD_NAME" >> $GITHUB_OUTPUT

      - name: Detox Test
        timeout-minutes: 20
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ env.API_LEVEL }}
          arch: ${{ env.ARCH }}
          avd-name: ${{ steps.device.outputs.AVD_NAME }}
          disable-animations: false
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          force-avd-creation: false
          script: >
            yarn detox test
            --configuration ${{ env.DETOX_CONFIGURATION }}
            --headless
            --record-logs failing
            --record-videos failing
            --take-screenshots failing

I get the following error:
ERROR | Not enough space to create userdata partition. Available: 4870.562500 MB at /home/runner/.android/avd/../avd/Pixel_8_Pro_API_34.avd, need 7372.800000 MB. which I think in turn does this:
adb: device 'emulator-5554' not found

Additional info:

API_LEVEL: 26
ARCH: x86_64
@poponuts poponuts added the question Further information is requested label Aug 29, 2024
@poponuts poponuts changed the title Would you know why AVD name shows "test" Would you know why emulator shows error: Not enough space to create userdata partition Aug 29, 2024
@remarkablemark
Copy link
Owner

@poponuts do you know if your machine on GitHub Actions has enough space?

@poponuts
Copy link
Author

I did this on my previous step to free disk space:

  sudo rm -rf /opt/hostedtoolcache
  sudo rm -rf /usr/share/dotnet
  sudo rm -rf /opt/ghc
  sudo rm -rf "/usr/local/share/boost"
  sudo rm -rf "$AGENT_TOOLSDIRECTORY"

Also, this works fine so unsure why running with same specs for detox test fails:

      - name: Create AVD and generate snapshot for caching
        if: steps.avd-cache.outputs.cache-hit != 'true'
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ env.API_LEVEL }}
          arch: ${{ env.ARCH }}
          disable-animations: false
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          force-avd-creation: false
          script: echo 'Generated AVD snapshot for caching.'

@remarkablemark
Copy link
Owner

What machine are you using to run the action? ubuntu-latest?

@poponuts
Copy link
Author

poponuts commented Sep 1, 2024

Yes, ubuntu-latest.
See below:

name: Mobile android e2e tests

env:
  CI: true
  DETOX_CONFIGURATION: android.emu.release
  API_LEVEL: 26
  ARCH: x86_64

on:
  pull_request:
    branches:
      - master

jobs:
  e2e-test:
    name: Run Tests
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4

      - name: Free Disk Space
        run: |
          sudo rm -rf /opt/hostedtoolcache
          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /opt/ghc
          sudo rm -rf "/usr/local/share/boost"
          sudo rm -rf "$AGENT_TOOLSDIRECTORY"

      - name: Enable KVM
        run: |
          echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
          sudo udevadm control --reload-rules
          sudo udevadm trigger --name-match=kvm

      - uses: actions/setup-node@v4
        # id: cache-node-modules
        with:
          node-version: '20.x'
          cache: 'yarn'

      - name: Install Dependencies
        run: yarn # install --frozen-lockfile

      - name: Setup Java
        uses: actions/setup-java@v4
        with:
          cache: gradle
          distribution: temurin
          java-version: 17

      - name: Gradle cache
        uses: gradle/actions/setup-gradle@v3

      - name: AVD cache
        uses: actions/cache@v4
        id: avd-cache
        with:
          path: |
            ~/.android/avd/*
            ~/.android/adb*
          key: avd-${{ env.API_LEVEL }}

      - name: Create AVD and generate snapshot for caching
        if: steps.avd-cache.outputs.cache-hit != 'true'
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ env.API_LEVEL }}
          arch: ${{ env.ARCH }}
          disable-animations: false
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          force-avd-creation: false
          script: echo 'Generated AVD snapshot for caching.'

      - name: Cache Detox Build
        id: cache-detox-build
        uses: actions/cache@v4
        with:
          path: android/app/build
          key: ${{ runner.os }}-detox-build
          restore-keys: |
            ${{ runner.os }}-detox-build

      - name: Detox Build
        if: steps.cache-detox-build.outputs.cache-hit != 'true'
        run: yarn e2e:android:build --if-missing

      - name: Get Device Name
        id: device
        run: |
          AVD_NAME=$(node -p "require('./.detoxrc').devices.emulator.device.avdName")
          echo "AVD_NAME=$AVD_NAME" >> $GITHUB_OUTPUT

      - name: Detox Test
        timeout-minutes: 20
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ env.API_LEVEL }}
          arch: ${{ env.ARCH }}
          avd-name: ${{ steps.device.outputs.AVD_NAME }}
          disable-animations: false
          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          force-avd-creation: false
          script: >
            yarn detox test
            --configuration ${{ env.DETOX_CONFIGURATION }}
            --headless
            --record-logs failing
            --record-videos failing
            --take-screenshots failing

      - name: Upload Artifacts
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: detox-artifacts
          path: artifacts

@remarkablemark
Copy link
Owner

Try commenting out the step Create AVD and generate snapshot for caching. See ReactiveCircus/android-emulator-runner#390 (comment)

@poponuts
Copy link
Author

poponuts commented Sep 2, 2024

Same issue after commenting out that step.
It says that:
I remedied this by deleting my temporary SDK build directory after a new SDK is built, freeing up GBs of space and this emulator action then works fine again.

Would you know how do I do this?

@remarkablemark
Copy link
Owner

Go to Actions > Caches and click the trash icon:

Screenshot 2024-09-01 at 11 51 43 PM

@poponuts
Copy link
Author

poponuts commented Sep 2, 2024

I have 0 caches so it seems even the Detox cache is not working for me in any case 😢
Screenshot 2024-09-02 at 2 51 48 PM

@remarkablemark
Copy link
Owner

Maybe try using a larger runner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants