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

INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package signatures do not match previously installed version #319

Open
hb0 opened this issue Feb 15, 2023 · 2 comments

Comments

@hb0
Copy link

hb0 commented Feb 15, 2023

We're using this Github Action to execute our connected tests.
This worked nicely, also after adding the AVD cache like described in the guide.

But after a few executions on multiple branches, we now get the following error (in both, our library project android-backend and our app project android-app:

> Task :submodule:connectedDebugAndroidTest
additionalTestOutput is not supported on this device running API level 28 because the additional test output directory could not be found
2023-02-15 14:25:01.135 qemu-system-x86_64[3763:12[599](https://github.com/org/repo/actions/runs/4184808537/jobs/7250971487#step:8:603)] [CAMetalLayer nextDrawable] returning nil because device is nil.
2023-02-15 14:25:01.283 qemu-system-x86_64[3763:12599] [CAMetalLayer nextDrawable] returning nil because device is nil.
2023-02-15 14:25:01.335 qemu-system-x86_64[3763:12599] [CAMetalLayer nextDrawable] returning nil because device is nil.
Exception thrown during onBeforeAll invocation of plugin com.google.testing.platform.plugin.android.AndroidDevicePlugin.
Failed to install APK(s): /Users/runner/work/android-backend/android-backend/submodule/build/outputs/apk/androidTest/debug/submodule-debug-androidTest.apk
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.example.submodule.test signatures do not match previously installed version; ignoring!
com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.examble.submodule.test signatures do not match previously installed version; ignoring!
	at com.android.ddmlib.internal.DeviceImpl.installRemotePackage(DeviceImpl.java:1315)
	at com.android.ddmlib.internal.DeviceImpl.installPackage(DeviceImpl.java:1141)
	at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackage(DdmlibAndroidDevice.kt)
	at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:173)
	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:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

I haven't found an issue in this repository for that error yet, so I'm posting this also for future readers.

When I execute the same Github Action again, the same error occurs.

Github Actions Workflow

You can checkout the workflow here, the relevant part is:

jobs:
  build:
    runs-on: macos-latest # as recommended in `actions/android-emulator-runner`

    strategy:
      matrix:
        api-level: [ 28 ]

(...)

      - name: Gradle cache
        uses: gradle/gradle-build-action@v2
      - name: AVD cache
        uses: actions/cache@v3
        id: avd-cache
        with:
          path: |
            ~/.android/avd/*
            ~/.android/adb*
          key: avd-${{ matrix.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: ${{ matrix.api-level }}
          force-avd-creation: false
          disable-animations: true
          script: echo "Generated AVD snapshot for caching."

      - name: Connected tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ matrix.api-level }}
          force-avd-creation: false
          emulator-options: -no-snapshot-save
          disable-animations: true
          script: ./gradlew :persistence:connectedDebugAndroidTest :datacapturing:connectedCyfaceMockDebugAndroidTest :synchronization:connectedCyfaceMockDebugAndroidTest :datacapturing:connectedMovebisMockDebugAndroidTest :synchronization:connectedMovebisMockDebugAndroidTest
          # in the `android-app` repository it's:
          # script: ./gradlew :measuring-client:connectedDebugAndroidTest

Workaround 1: Clear cache

When I remove all caches and execute the Workflow again, the error disappears, but reappears after some executions.

The caches look like this:
Screenshot from 2023-02-15 15-37-45

Workaround 2: Disable AVD cache

The error does not appear, when I clear the cache and then disable AVD caching, so the issue seems to be caused by the AVD cache. The previously installed test bundles seem not be cleared, which seem to cause the error.

grodin pushed a commit to OmriCat/map-librarian that referenced this issue Mar 9, 2023
Caching the AVDs on github causes failures when installing the
test apk.
See ReactiveCircus/android-emulator-runner#319
grodin pushed a commit to OmriCat/map-librarian that referenced this issue Mar 21, 2023
grodin pushed a commit to OmriCat/map-librarian that referenced this issue Mar 21, 2023
grodin pushed a commit to OmriCat/map-librarian that referenced this issue Mar 21, 2023
grodin pushed a commit to OmriCat/map-librarian that referenced this issue Mar 21, 2023
@Hatzen
Copy link

Hatzen commented Aug 5, 2023

I have faced this issue with explorativ tests when i tried to install an older verison of this apk.
I guess this error wont appear if u automatically increase the apk version before running the test

@AnandaDwiprayoga
Copy link

+1, i'm also faced this issue after adding AVD cache

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

No branches or pull requests

3 participants