After downgrading from Gradle 6.1.1 to 7.2 and Android Gradle Build tools 7.1.0 to 4.0.1 (by switching branches in Git) I got the following exception in the Run console (tool window) of Android Studio Bumblebee 2021.1.1 (when trying to run the app on a device):
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: Couldn't get post build model. Module: My_App.app Variant: debug
The Grade build runs successfully but the app won’t be installed in the device.
2
Answers
In Android Studio run
File > Invalidate Caches ...
and restart (you don't need to select the optional "Clear file system cache and Local History"). Just to be sure, also runBuild > Clean Project
.I have faced this issue when i upgrade to android studio Dolphin. So for me this workaround was to delete the existing app configuration from Run/Debug Configurations.
After that add new configuration by clicking the left top + icon and then add Android App.