I had the same issue: in my case there were 2 things I needed to do.
1. Provide keystore parameters
I wasn't providing the right signingConfig
credentials to the app crawler, hence the error: does not have a signature matching the target
.
I was using a debug build and thought there was no way this could be the issue since my default buildType didn't set a signingConfig - it just looked like this:
buildTypes {
debug {
debuggable true
}
...
}
I was wrong, because the project had defined a signingConfigs.debug value, which is then implicitly used as the signingConfig for debug (see https://stackoverflow.com/a/28512848/6007104).
So, I added the --key-store
and --key-store-password
parameters to the java -jar crawl_launcher.jar
command, with values matching my signingConfigs.debug
config.
2. Manual install
I looked further in the log and found a line: Unable to find instrumentation target package <my.package>
. To fix this issue, I manually installed the app and test apks, instead of relying on the App Crawler to do it for me.
I generated the app apk with ./gradlew assembleDebug
and the test apk with ./gradlew connectedDebugAndroidTest
, and then manually installed both apks on the device (app first, then test). And then I ran the app crawler.
Conclusion
Here's what I do every time I want to launch the app crawler.
adb uninstall androidx.test.tools.crawler
adb uninstall androidx.test.tools.crawler.stubapp
adb uninstall <my.package>
Generate app apk:
./gradlew assembleDebug
Generate test apk:
./gradlew connectedDebugAndroidTest
Install the app apk, then the test apk (you can use adb)
Run the app crawler from the unzipped app-crawler directory. Use the --app-package-name
parameter instead of the --apk-file
parameter. Make sure --key-store
and --key-store-password
are provided if needed:
java -jar crawl_launcher.jar --android-sdk <my/sdk/location> --app-package-name <my.package> --key-store <my/location/debug.keystore> --key-store-password <mypassword>