0

I have an app with a rather big file size which means that I have to wait for 10-20 seconds between pressing Ctrl+F5 and having the new app instance running on a connected device.

This timespan is long enough for me to deal with other things, e.g. staging my changes and then looking back at the device wondering whether the new version is already running or if I'm looking at the old state. Usually I then start clicking to test the new implementation and then the app closes and reopens since the upload took longer than expected.

How can I visually be notified of the first run after an upload to the device?

The following things won't work:

  1. Save the version in the preferences and compare at startup time. I don't change the version string for every small change.
Community
  • 1
  • 1
PhilLab
  • 4,777
  • 1
  • 25
  • 77

2 Answers2

0

You could increment the version number with each build, and display it in your app. Here is an example on how you can to that.

Community
  • 1
  • 1
Rares Barbantan
  • 761
  • 4
  • 9
0

I found a solution and posted it on my blog, here it is:

  1. Open Android Studio → Run → Edit Configurations

  2. Select your application, scroll to the bottom to the “Before launch” section. Click Plus -> Run External Tool -> Click Plus.Set the values:

    Name: Force-stop app program: adb.exe parameters: shell am force-stop enter image description here

  3. Make sure that the external tool runs before the Gradle-aware Make in the “Before Launch” section

Community
  • 1
  • 1
PhilLab
  • 4,777
  • 1
  • 25
  • 77