@@ -74,15 +74,18 @@ jobs:
7474 path : |
7575 ~/.android/avd/*
7676 ~/.android/adb*
77- key : avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}
77+ key : avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-${{ hashFiles('**/libs.versions.toml') }}
78+ restore-keys : |
79+ avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-
7880 - name : Create AVD and generate snapshot for caching
7981 if : steps.avd-cache.outputs.cache-hit != 'true'
8082 uses : reactivecircus/android-emulator-runner@v2
8183 with :
8284 api-level : ${{ matrix.api-level }}
8385 target : ${{ matrix.target }}
8486 arch : ${{ matrix.arch }}
85- force-avd-creation : false
87+ # FORCE true here ensures if 'actions/cache' restored old avd, we wipe and start with a fresh image for the new dependency hash.
88+ force-avd-creation : true
8689 emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-load
8790 disable-animations : false
8891 script : echo "Generated AVD snapshot for caching."
9598 arch : ${{ matrix.arch }}
9699 emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
97100 script : |
98- # Uninstall existing packages to avoid INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
99- # when a cached AVD snapshot has old APKs signed with different keys.
100- adb uninstall com.squareup.leakcanary || true
101- adb uninstall com.squareup.leakcanary.test || true
102- adb uninstall com.squareup.leakcanary.core || true
103- adb uninstall com.squareup.leakcanary.core.test || true
104- adb uninstall com.squareup.leakcanary.instrumentation || true
105- adb uninstall com.squareup.leakcanary.instrumentation.test || true
106101 touch emulator.log
107102 chmod 777 emulator.log
108103 adb logcat >> emulator.log &
0 commit comments