From a66e96f70b1d46961fc5a3f6324d0d960bc1337b Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 15 Mar 2026 07:39:39 +0000 Subject: fix: rasterise vector drawable for MapLibre; add startup smoke test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: BitmapFactory.decodeResource() returns null for vector drawables (ic_tidal_arrow.xml). style.addImage(id, null) then NPE-crashed inside MapLibre's native layer. The previous style URL was invalid so the setStyle callback never fired and the bug was hidden; fixing the URL in c7b42ab exposed it. Fix: draw the VectorDrawable onto a Canvas to produce a real Bitmap before handing it to MapLibre, matching the pattern already used in MapFragment for the wind-arrow icon. Also adds: - MainActivitySmokeTest: Espresso test that launches MainActivity and asserts it doesn't immediately crash — catches this class of bug. - CI smoke-test job: runs the Espresso test on an API-30 emulator via reactivecircus/android-emulator-runner after the build job passes. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/android.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 78584dc..701b6c4 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Set up JDK 17 uses: actions/setup-java@v4 with: @@ -24,7 +24,7 @@ jobs: run: chmod +x android-app/gradlew - name: Build with Gradle - run: ./gradlew assembleDebug + run: ./gradlew assembleDebug assembleDebugAndroidTest working-directory: android-app - name: Upload artifact @@ -41,3 +41,36 @@ jobs: serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} groups: testers file: android-app/app/build/outputs/apk/debug/app-debug.apk + + smoke-test: + runs-on: ubuntu-latest + # Run after build succeeds so we don't spin up an emulator for a broken build + needs: build + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x android-app/gradlew + + - name: Enable KVM (faster emulator) + 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 + + - name: Run smoke tests on emulator + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 30 + arch: x86_64 + profile: pixel_3a + script: ./gradlew connectedDebugAndroidTest + working-directory: android-app -- cgit v1.2.3