I faced a situation in which the version from the built debug APK had inexplicable runtime errors which disappeared after the rebuild. No code changes - just fresh build. Today it happened at least a second time - it starts to worry me.
It's a waste of time to determine that error couldn't be repeated on my emulator and I just need to rebuild it. Here I can only build APKs one by one until I get two files equal to byte. Though I've never faced the same problem while installing directly through USB, it couldn't be a solution as I don't have physical access to it all the time.
Update. Today such a thing happened through USB installation.
The second reason is main here. Can I be sure the release build doesn't have the same problem? Now I build AAB files that I can't install on a device to check before update in Google Play.
Current Android Studio version:
Android Studio Arctic Fox | 2020.3.1 Patch 1 Build
#AI-203.7717.56.2031.7621141, built on August 7, 2021
Update. Repeated on Android Studio version:
Android Studio Arctic Fox | 2020.3.1 Patch 2 Build
#AI-203.7717.56.2031.7678000, built on August 27, 2021
Other build settings
buildToolsVersion '30.0.2'
gradle version 7.0.2
Why does it happen? Is there any workaround?