5

I was trying to run app crawler locally in order to test robo scripts created in Android Studio.

I followed this handy article (https://android.jlelse.eu/test-robo-scripts-locally-useful-for-firebase-test-lab-pre-launch-reports-41da83d5769f) and ran into an issue where the crawler just said crawl started and crawl finished immediately. I couldn't find any answers on google for this issue.

Here's the error from the logs:

Permission Denial: starting instrumentation ComponentInfo{androidx.test.tools.crawler/androidx.test.tools.crawler.CrawlMonitor} from pid=3778, uid=3778 not allowed because package androidx.test.tools.crawler does not have a signature matching the target androidx.test.tools.crawler.stubapp

I finally figured out a solution so I'm putting this question out to help those who might have been stuck like me. Sounds like some people had the same issue in this question (https://stackoverflow.com/a/58631206/13071692)

Riccardo
  • 1,083
  • 2
  • 15
  • 25
thesultan192
  • 169
  • 9

2 Answers2

5

I figured out that this error is coming up because I was using a debug apk version of my app. It requires a signed version so once I created a signed version in android studio (Build > Generate Signed Bundle... ) it worked great

thesultan192
  • 169
  • 9
0

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.

  • Uninstall old artifacts:
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>
Luke Needham
  • 3,373
  • 1
  • 24
  • 41
  • Been searching for a solution and still this did not work either. I give up... wasted way too much time on this. – JPM Aug 14 '23 at 16:29