Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force install of Android App in Development Environment?

Tags:

android

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?

like image 826
Code Droid Avatar asked May 02 '12 22:05

Code Droid


4 Answers

adb has [-r] parameter to reinstall.

adb install -r some.apk
like image 136
Rizky Farhan Avatar answered Nov 04 '22 17:11

Rizky Farhan


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.

like image 29
Chris Stratton Avatar answered Nov 04 '22 19:11

Chris Stratton


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 signature already installed.

When you say you only do code checkouts, rebuild and your signature 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 signature.

like image 12
WarrenFaith Avatar answered Nov 04 '22 19:11

WarrenFaith


adb install -r -d path/to/file.apk

-r to replace -d to force downgrade

like image 4
Robert Apikyan Avatar answered Nov 04 '22 17:11

Robert Apikyan