如何在开发环境中强制安装Android App?

时间:2022-03-20 06:56:54

I'm tired of uninstalling and than reinstalling in development.
Is there a way to do adb -force install some.apk ? I mean this would save a lot of time. Each time going to system ->apps->uninstall every time a signature is different.

我厌倦了卸载而不是重新开发。有没有办法做adb -force install some.apk?我的意思是这会节省很多时间。每次进入系统 - > apps->每次签名都不同时卸载。

Obviously debug is a dev setting so I don't see why one constantly needs to uninstall the app manually, what a waste of time? Anything that can make development easier is going to result in better code, and better apps so whats up with this?

显然调试是一个开发设置,所以我不明白为什么一个人经常需要手动卸载应用程序,这是多少浪费时间?任何可以使开发更容易的东西都会带来更好的代码,更好的应用程序会带来什么呢?

I have hot deployed to server side Java EE servers in less time. This is less an issue on command line, since one could do an uninstall or replace the adb script with an uninstall followed by an install.
However in eclipse its still a pain. It has been pointed out that this is largely about signature changes. Yes, it is. But why should signatures change in development, and debug mode, and cause the reinstallation issue?

我在较短的时间内部署到服务器端Java EE服务器。这在命令行上不是问题,因为可以通过卸载然后安装来卸载或替换adb脚本。然而在日食中它仍然是一种痛苦。有人指出,这主要是签名的变化。是的。但是为什么签名会在开发和调试模式中发生变化,并导致重新安装问题?

5 个解决方案

#1


12  

UPDATE:

Thanks to the downvoters. If you prefer a one line answer that only addresses half of the issue (like certificate changes!), feel free to upvote the answer you prefer. If you downvote this answer, please at least leave a comment to tell me why so that I can address the issue. That would be only fair. Thank you.

感谢downvoters。如果您更喜欢仅解决问题一半的一行答案(如证书更改!),请随意提供您喜欢的答案。如果您对此答案进行了投票,请至少发表评论告诉我为什么这样才能解决问题。那是公平的。谢谢。

original answer:

The normal build process uses the android debug keystore that can be found in your android folder in your home directory (path depends on your OS).

正常的构建过程使用可以在主目录中的android文件夹中找到的android调试密钥库(路径取决于您的操作系统)。

With this debug keystore your app will be signed. This debug signature can be installed on every android device in the world as long as there isn't your app with another signiture already installed.

使用此调试密钥库,您的应用程序将被签名。只要没有已安装其他签名的应用程序,此调试签名就可以安装在世界上的每个Android设备上。

When you say you only do code checkouts, rebuild and your signiture is different, than probably your build process is broken. Your debug keystore is valid for at least a year and as long as you are on the same PC while building the generated APK should never have a different signature.

当你说你只做代码检查时,重建和你的签名是不同的,可能你的构建过程被打破了。您的调试密钥库至少有效一年,只要您在同一台PC上,构建生成的APK时就不应该有不同的签名。

For further checking you should bring some light in your development process. What do you use? Eclipse?

为了进一步检查,您应该为开发过程带来一些启发。你用什么?蚀?

If you work on different developing machines, pick one keystore from one machine and put it into your version control and use this to sign your apk with the debug signiture.

如果您在不同的开发机器上工作,请从一台机器中选择一个密钥库并将其放入您的版本控制中,然后使用它来使用调试签名对您的apk进行签名。

#2


184  

adb has [-r] parameter to reinstall.

adb有[-r]参数重新安装。

adb install -r some.apk

#3


7  

A web search you could have done reveals that the answer to your adb question is:

您可以进行的网络搜索显示您的adb问题的答案是:

adb uninstall some.package.name

Note that it's not the file.apk name you use with adb install, but rather the actual package name it ends up installed as.

请注意,它不是与adb install一起使用的file.apk名称,而是它最终安装的实际包名称。

#4


-2  

The debug keystore can be set in Eclipse in Preferences/Android/Build/Custom debug keystore, which is very helpful when working in a team. Every member should set up the same keystore there, and then it is no problem any longer to share devices.

可以在Preferences / Android / Build / Custom debug keystore中的Eclipse中设置调试密钥库,这在团队中工作时非常有用。每个成员都应该在那里设置相同的密钥库,然后共享设备就没有问题了。

#5


-3  

for uninstall adb uninstall app_package_name

用于卸载adb uninstall app_package_name

for install adb install app_package_name

用于安装adb install app_package_name

into the command prompt in windows and terminal in linex/Macos

进入windows中的命令提示符和linex / Macos中的终端

#1


12  

UPDATE:

Thanks to the downvoters. If you prefer a one line answer that only addresses half of the issue (like certificate changes!), feel free to upvote the answer you prefer. If you downvote this answer, please at least leave a comment to tell me why so that I can address the issue. That would be only fair. Thank you.

感谢downvoters。如果您更喜欢仅解决问题一半的一行答案(如证书更改!),请随意提供您喜欢的答案。如果您对此答案进行了投票,请至少发表评论告诉我为什么这样才能解决问题。那是公平的。谢谢。

original answer:

The normal build process uses the android debug keystore that can be found in your android folder in your home directory (path depends on your OS).

正常的构建过程使用可以在主目录中的android文件夹中找到的android调试密钥库(路径取决于您的操作系统)。

With this debug keystore your app will be signed. This debug signature can be installed on every android device in the world as long as there isn't your app with another signiture already installed.

使用此调试密钥库,您的应用程序将被签名。只要没有已安装其他签名的应用程序,此调试签名就可以安装在世界上的每个Android设备上。

When you say you only do code checkouts, rebuild and your signiture is different, than probably your build process is broken. Your debug keystore is valid for at least a year and as long as you are on the same PC while building the generated APK should never have a different signature.

当你说你只做代码检查时,重建和你的签名是不同的,可能你的构建过程被打破了。您的调试密钥库至少有效一年,只要您在同一台PC上,构建生成的APK时就不应该有不同的签名。

For further checking you should bring some light in your development process. What do you use? Eclipse?

为了进一步检查,您应该为开发过程带来一些启发。你用什么?蚀?

If you work on different developing machines, pick one keystore from one machine and put it into your version control and use this to sign your apk with the debug signiture.

如果您在不同的开发机器上工作,请从一台机器中选择一个密钥库并将其放入您的版本控制中,然后使用它来使用调试签名对您的apk进行签名。

#2


184  

adb has [-r] parameter to reinstall.

adb有[-r]参数重新安装。

adb install -r some.apk

#3


7  

A web search you could have done reveals that the answer to your adb question is:

您可以进行的网络搜索显示您的adb问题的答案是:

adb uninstall some.package.name

Note that it's not the file.apk name you use with adb install, but rather the actual package name it ends up installed as.

请注意,它不是与adb install一起使用的file.apk名称,而是它最终安装的实际包名称。

#4


-2  

The debug keystore can be set in Eclipse in Preferences/Android/Build/Custom debug keystore, which is very helpful when working in a team. Every member should set up the same keystore there, and then it is no problem any longer to share devices.

可以在Preferences / Android / Build / Custom debug keystore中的Eclipse中设置调试密钥库,这在团队中工作时非常有用。每个成员都应该在那里设置相同的密钥库,然后共享设备就没有问题了。

#5


-3  

for uninstall adb uninstall app_package_name

用于卸载adb uninstall app_package_name

for install adb install app_package_name

用于安装adb install app_package_name

into the command prompt in windows and terminal in linex/Macos

进入windows中的命令提示符和linex / Macos中的终端