Cant install Api Demos apps in my IDE because of a signing error

The Android system requires that all applications be signed, as described in Signing Your Applications. The ApiDemos applications included with the SDK are preinstalled on the emulator and for that reason have been compiled and signed with a private key.

If you want to modify or run one of the ApiDemos apps from Eclipse/ADT or other IDE, you can do so so only after you uninstall the preinstalled version of the app from the emulator. If you try to run an ApiDemos apps from your IDE without removing the preinstalled version first, you will get errors similar to:

[2008-08-13 15:14:15 - ApiDemos] Re-installation failed due to different application signatures.

[2008-08-13 15:14:15 - ApiDemos] You must perform a full uninstall of the application. WARNING: ...This will remove the application data!

[2008-08-13 15:14:15 - ApiDemos] Please execute 'adb uninstall' in a shell.

The error occurs because, in this case, you are attempting to install another copy of ApiDemos onto the emulator, a copy that is signed with a different certificate (the Android IDE tools will have signed the app with a debug certificate, where the existing version was already signed with a private certificate). The system does not allow this type of reinstallation.

To resolve the issue, you need to fully uninstall the preinstalled and then reinstall it using the adb tool. Here's how to do that:

1. In a terminal, change to the tools directory of the SDK.

2. If no emulator instance is running, start an emulator using using the command emulator &.

3. Uninstall the preinstalled app using the command adb uninstall

4. Reinstall the app using the command adb install <path to the ApiDemos.apk>. If you are working in Eclipse/ADT, you can just compile and run the app in the normal way.

Note that if multiple emulator instances are running, you need to direct your uninstall/install commands to the emulator instance that you are targeting. To do that you can add the -s <serialNumber> to the command, for example:

adb -s emulator-5556 install

For more information about adb, see the Android Debug Bridge documentation.

0 0

Post a comment