The path may be invalid, if Android Studio is pointing to the wrong version of the file. This can happen if you make gradle automatically rename your built APK, using setProperty(), like:
defaultConfig {
applicationId "com.company.app"
versionName "1.2.0"
// Rename the built apk file
setProperty("archivesBaseName", "MyApp-$versionName")
...
}
Sometimes, an updated versionName
is not properly "refreshed" to Android Studio, so it can point to an old versionName in the file name. In this case, just do a Gradle sync then Build, to ensure the versionName
matches the built file path. Gradle sync is either:
- Android Studio 4.x ➔ Toolbar at the far right ➔ Press the 'elephant + down arrow' icon, which has the tooltip "Sync Project with Gradle Files" ➔ Build ➔ Make Project
- Android Studio 4.x ➔ Help ➔ Find Action ➔ search for "sync" ➔ "Sync Project with Gradle Files" ➔ Build ➔ Make Project