Installing/Updating APKs onto an Android Phone
June 4th, 2009
While developing for Android, I found myself installing and reinstalling various .apk files. I use Windows 7, but this applies to Windows in general. I created a shortcut so that I can just double-click an apk and install it.
If you have the SDK setup and working, skip ahead to step 3.
- Download the Android SDK Download.
- Install using the Android SDK Install Guide.
- In summary:
- Pick a place on your HD and extract the folder.
- Go into Control Panel \ System \ [Advanced system settings on Sidebar] \ Advanced tab \ Environment Variables \ System variables \ PATH
- Append a semicolon (;) followed by where you extracted it to with the tools folder.
IE: Path = …;…;C:\android-sdk-1.5\tools
- In notepad, paste the text below and save it in that tools folder as “installapk.bat”.
NOTE: Make sure, in the Save As box, that you change the “Save as type” from Text Documents to All Files. That way you don’t get a secret .txt append on there. - Double-click any .apk you have lying around.
- Click “Select a program from a list of install programs”, then OK.
- Check “Always use the selected program to open this kind of file”
- Click Browse and select the .bat file you created.
- Click Open and you are done!
Additional tip: If you always install to the emulator, add -e directly after the “adb”. If you always install to your device, add -d after the “adb”.
@ECHO OFF ECHO Selected: %* ECHO. CHOICE /c:CIR /m "Install, Reinstall or Cancel? " IF errorlevel 3 GOTO reinstall IF errorlevel 2 GOTO install GOTO cancel :install adb install %* GOTO done :reinstall adb install -r %* GOTO done :cancel EXIT :done PAUSE