Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

排除 Re-installation failed due to different application signatures 錯誤

編輯:關於 Android 程式設計

問題描述

在 Eclipse 中匯入一個已存在的專案並嘗試執行時,出現以下錯誤:

[2011-06-09 10:08:37 - ApiDemos] Re-installation failed due to different application signatures.
[2011-06-09 10:08:37 - ApiDemos] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-06-09 10:08:37 - ApiDemos] Please execute 'adb uninstall com.example.android.apis' in a shell.
[2011-06-09 10:08:37 - ApiDemos] Launch canceled!

原因分析

這個錯誤的意思是:模擬器或裝置上已經安裝了同套件名稱(package)的 App,但它当初是用「另一把簽章憑證」簽署的,與你現在專案要安裝的版本簽章不一致。Android 不允許用不同簽章去覆蓋安裝同一個 package,因此必須先完整移除舊版本。

解決辦法

先啟動 Android 模擬器,然後開啟命令提示字元(cmd),切換到 adb 所在的 platform-tools 目錄(例如 E:\Android\android-sdk-windows\platform-tools),執行移除指令:

E:\android\android-sdk-windows\platform-tools> adb uninstall com.example.android.apis

移除成功後,回到 Eclipse 重新執行專案即可正常安裝與啟動。

提醒:如訊息中警告所述,卸載會一併清除該 App 的既有資料,正式環境下請先三思。這類簽章衝突在團隊開發或切換電腦環境時相當常見,記得先乾淨移除舊版再安裝,就能避免這個惱人的錯誤。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved