Home » Android » How to force install of Android App in Development Environment?

How to force install of Android App in Development Environment?

Posted by: admin February 23, 2018 Leave a comment

Questions:

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.

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?

Answers:

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.

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).

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.

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.

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.

Questions:
Answers:

adb has [-r] parameter to reinstall.

adb install -r some.apk

Questions:
Answers:

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

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.

Questions:
Answers:

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.

Questions:
Answers:

for uninstall
adb uninstall app_package_name

for install
adb install app_package_name

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