简体   繁体   中英

“App not installed” when trying to install over existing debug apk

When two or more developers work in a team, they can't overwrite the installed APK if it is generated by the other developers. This is the exact scenario:

  1. Two developers are working on same Android project.
  2. When developer one generates and shares debug APK. its getting installed on device and runs properly.
  3. When developer two generates the debug APK with same codebase and try to install app over app shared by developer one it shows message as "App not installed".
  4. When developer one again share debug APK then it gets installed over the existing app.

Can anyone tell why this error occurs is there any laptop level dependency is there?

Why this happens

This happens because the app you are building on Android is being signed with a specific keystore that is generated on your local machine. So when developer 1 signs the app with his keystore, it gets his fingerprint and you can install it fine. But when developer 2 builds the app with his (different) keystore, it gets a different fingerprint. Therefore Android won't let you overwrite the app that was already installed. The solution would be to share the debug keystore so the fingerprints of all APK's will align.

The keystore can be found in ~/.android/debug.keystore .

How to verify

You can verify the fingerprint of your APK's with the following command: keytool -printcert -jarfile app.apk , or keytool -printcert -jarfile app.aab in case you output an aab.

Before generating debug APK, Android Studio automatically signs your app with a debug certificate generated by the Android SDK tools. So both the APKs are signed with different keys.

You can read more here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM