简体   繁体   English

尝试安装现有调试 apk 时出现“未安装应用程序”

[英]“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.当两个或多个开发者在一个团队中工作时,如果它是由其他开发者生成的,他们不能覆盖已安装的 APK。 This is the exact scenario:这是确切的场景:

  1. Two developers are working on same Android project.两名开发人员正在开发同一个 Android 项目。
  2. When developer one generates and shares debug APK.当开发人员一生成并共享调试 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".当开发人员二生成具有相同代码库的调试 APK 并尝试通过开发人员一共享的应用程序安装应用程序时,它显示消息为“应用程序未安装”。
  4. When developer one again share debug APK then it gets installed over the existing app.当开发人员再次共享调试 APK 时,它会安装在现有应用程序上。

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.发生这种情况是因为您在 Android 上构建的应用程序正在使用本地计算机上生成的特定密钥库进行签名。 So when developer 1 signs the app with his keystore, it gets his fingerprint and you can install it fine.因此,当开发人员 1 使用他的密钥库对应用程序进行签名时,它会获取他的指纹并且您可以正常安装它。 But when developer 2 builds the app with his (different) keystore, it gets a different fingerprint.但是当开发人员 2 使用他的(不同的)密钥库构建应用程序时,它会获得不同的指纹。 Therefore Android won't let you overwrite the app that was already installed.因此 Android 不会让您覆盖已安装的应用程序。 The solution would be to share the debug keystore so the fingerprints of all APK's will align.解决方案是共享调试密钥库,以便所有 APK 的指纹对齐。

The keystore can be found in ~/.android/debug.keystore .密钥库可以在~/.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.您可以使用以下命令验证 APK 的指纹: keytool -printcert -jarfile app.apkkeytool -printcert -jarfile app.aab如果您是 output 是 aab。

Before generating debug APK, Android Studio automatically signs your app with a debug certificate generated by the Android SDK tools.在生成调试 APK 之前,Android Studio 会自动使用由 Android SDK 工具生成的调试证书对您的应用进行签名。 So both the APKs are signed with different keys.因此,这两个 APK 都使用不同的密钥签名。

You can read more here你可以在这里阅读更多

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android APK和Debug安装了该应用的多个版本 - Android APK and Debug install multiple versions of the app 应用程序在 USB 调试模式下工作正常,但是当我生成签名 APK 并安装它时,它不起作用 - App is working fine in usb debug mode, but when i generate Signed APK and install it, its not working 调试apk上的设备错误显示“未安装应用程序”,“文件似乎已损坏” - “App not installed” on device error from debug apk, “File appears to be corrupt” Android Studio:从 Run 'app' 安装的应用程序和从 build/outputs/apk/debug/app-debug.apk 安装的应用程序是不同的 - Android Studio: The application installed from Run 'app' and application installed from build/outputs/apk/debug/app-debug.apk are different 尝试安装发行版 APK 时出现错误代码 -7 - Error code -7 when trying to install release APK 仅当我从Android Studio中安装Android应用程序时,该应用程序才能运行,而当我直接在其他手机上安装APK时,则无法运行 - Android app is working only when I installed it from Android Studio But not when I install the APK directly on other phones 尝试为应用构建APK时出错 - Error when trying to build APK for app 尝试安装未签名的远程.apk文件时出现不一致的解析错误 - Inconsistent Parsing Error when trying to install an unsigned remote .apk file 在Android L上构建并在Android K上安装时分发的调试APK进行测试时崩溃 - Debug APK distributed for testing crashes when built on Android L and installed on Android K 尝试使用Intellij调试SpringBoot应用程序时出现问题 - Issues when trying to debug SpringBoot app with Intellij
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM