So I got annoyed at always having to reconnect to Stetho, and I figured there would be some better way to do this in Android Studio ... and maybe there is, but this is the best I've gotten so far. Putting this together in a gist was inspired by a question on reddit: https://www.reddit.com/r/androiddev/comments/7hz3xy/stetho_anyone_know_of_a_convenient_way_to/
- Use Android Studio custom Run configuration to call a new gradle task
:app:launchStetho
before the app launches - The gradle task uses
launchctl
(docs) to start an out-of-band AppleScript automationopen-stetho.applescript
- The AppleScript waits a few seconds, then controls Chrome to open chrome://inspect and loops until the "Inspect" action is available, and then executes a
click()
against that DOM element
- Choose a location for the applescript and ensure that it's executable `chmo