無法安裝同一個名稱的程式

事情是這樣子的

最近在開發程式時,忘記先解安裝舊的同名應用程式 from eclips,再來安裝新的同名程式 from apk

直接安裝新的時,就會發現Install Fail。

查了一下原因,原來是Application的Install,類似Windows程式需要Register一樣,Android 的 Applicatoin需要Signing。

 

I can't install ApiDemos 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

[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 com.android.samples' 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 com.android.samples.

  4. Reinstall the app using the command adb install . 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 to the command, for example:

adb -s emulator-5556 install

不過雖然知道了這件事

我因為手賤,把應用程式直接kill掉,然後再直接刪除目錄,所以就沒法用 adb uninstall的方式...

所以問題還是沒解決,有什麼其他的解法呢?