ReactiveCircus / android-emulator-runner

A GitHub Action for installing, configuring and running hardware-accelerated Android Emulators on macOS virtual machines.
Apache License 2.0
977 stars 193 forks source link

Failed to install split APK(s) #387

Open joshing-dev opened 7 months ago

joshing-dev commented 7 months ago

I'm using this setup for my github action:

  instrumented-tests:
    name: Run Instrumented Tests
    runs-on: macos-latest
    steps:
      - name: checkout
        uses: actions/checkout@v3
      - name: Configure JDK
        uses: actions/setup-java@v1
        with:
          java-version: 17
      - name: run tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 29
          script: ./gradlew connectedAndroidTest

But when running connectedAndroidTest I'm getting this error:

Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: UNKNOWN
NameSpace: DdmlibAndroidDeviceController
ErrorCode: 1
ErrorType: TEST
Message: Failed to install split APK(s): [/Users/runner/work/Budgeteer/Budgeteer/core/database/build/outputs/apk/androidTest/debug/database-debug-androidTest.apk]
Failed to install split APK(s): [/Users/runner/work/Budgeteer/Budgeteer/core/database/build/outputs/apk/androidTest/debug/database-debug-androidTest.apk]
Device emulator-5554 API level=1. Cannot install split APKs with API level < 21
Device emulator-5554 API level=1. Cannot install split APKs with API level < 21
java.lang.IllegalArgumentException: Device emulator-5554 API level=1. Cannot install split APKs with API level < 21
    at com.android.ddmlib.SplitApkInstallerBase.validateApiLevel(SplitApkInstallerBase.java:245)
    at com.android.ddmlib.SplitApkInstaller.validateArguments(SplitApkInstaller.java:162)
    at com.android.ddmlib.SplitApkInstaller.create(SplitApkInstaller.java:190)
    at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:394)
    at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$36(DeviceImpl.java:1492)
    at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
    at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1489)
    at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$37(DeviceImpl.java:1504)
    at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
    at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1500)
    at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackages(DdmlibAndroidDevice.kt:74)
    at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:254)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

I use this same defined job on other projects, but I'm unsure why it's saying it's using a Device emulator with an API level of 1?

My project uses a min-sdk of 26 and a compile-sdk/target-sdk of 34 and AGP version of 8.3.1 with the action specifying an api-level of 29.

takahirom commented 7 months ago

I'm experiencing the same issue. However, I'm not sure if I'm using a split APK. yaml https://github.com/takahirom/Rin/blob/main/.github/workflows/emulator-test.yml CI result https://github.com/takahirom/Rin/actions/runs/8593582109/job/23545585072

I was able to run this test 4 days ago. https://github.com/takahirom/Rin/actions/runs/8553042186/job/23435398097

evermind-zz commented 6 months ago

https://issuetracker.google.com/issues/328279698

-> upgrade to AGP 8.3.2

LeonelZalegas commented 3 months ago

used to have the same problem, solve it by changing the actions with "uses: actions/checkout@v4" for some reason worked for me