Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The uploaded APK does not have valid signature Firebase TestLab instrument test type

I'm trying to testing with my demo app with firebase test lab with instrument test type but i'm not able to test that due to following error regarding to apk. enter image description here

I uploaded the debug-keystore signed apk there. Even in my other project i also uploaded my own keystore signed apk there with my androidTest.apk but same error is showing. Please guide me if i'm missing some major steps. Thanks

like image 708
Zohaib Akram Avatar asked Oct 31 '19 10:10

Zohaib Akram


2 Answers

I came across the same issue. I tried uploading different versions of APKs - signed, not signed, from the build\outputs\apk, combined test with the release APK - nothing worked.

The way I got it to work was by running the instrumentation tests on the Firebase Test Lab Device Matrix from Android Studio (see here for steps https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests#run-ctl). Then it turns out Android Studio generates valid APKs in:
build\outputs\apk\debug\-debug.apk
build\outputs\apk\androidTest\debug\-debug-androidTest.apk

Then when you upload those generated everything works fine.

Just as as a tip - if you don't want the test to actually run from Android Studio but only to generate the APKs (I prefer to run them via the firebase website because it offers a better control over what devices, locales etc.), you can define it to run it on a non-existing combination of a device and API level e.g. Emulator Pixel 2 and API level 25. If you do that Android Studio will generate the APKs but will not actually run - meaning as far as I can see it will not decrease your daily free quota :).

like image 162
v0rin Avatar answered Nov 19 '22 04:11

v0rin


I build both apks via AndroidStudio > Gradle and it works for me.

enter image description here

Choose:

  1. assembleDebug
  2. assembleAndroidTest

Then find apk in packages:

  1. ...\app\build\outputs\apk\myFlavor\debug
  2. ...\app\build\outputs\apk\androidTest\myFlavor>\debug

(Take a look at the date of the apk, just to make sure this is the one that was just built)

Then simply upload those apks to Firebase Test Lab

BTW, running via Android Studio > Edit Configuration...> Target > Firebase Test Lab Device Matrix works as well.

like image 10
Andrew Avatar answered Nov 19 '22 06:11

Andrew