2012-01-27 56 views
2

我是新來的Android,只是試圖將一個示例項目(藍牙聊天應用程序)加載到我的智能手機(運行Android 2.3.4)。 Eclipse中的目標構建項目使用Android API級別15(Android 4.0.3)。當我嘗試使用連接的手機進行「以Android應用程序運行」時,Android設備選擇器會指出該設備不兼容,並且出現以下文本中顯示的錯誤。我如何解決這個問題?當然,我不應該將我的構建目標降級到更低的API級別(10)以及可能的鬆散功能?不兼容的Android目標設備?

順便說一句,同樣的項目包括在這個清單:

<uses-sdk minSdkVersion="6" /> 

[2012-01-27 19:59:43 - BluetoothChat] Android Launch! 
[2012-01-27 19:59:43 - BluetoothChat] adb is running normally. 
[2012-01-27 19:59:43 - BluetoothChat] Performing com.example.android.BluetoothChat.BluetoothChat activity launch 
[2012-01-27 19:59:43 - BluetoothChat] Automatic Target Mode: Unable to detect device compatibility. Please select a target device. 
[2012-01-27 20:00:02 - BluetoothChat] WARNING: Application does not specify an API level requirement! 
[2012-01-27 20:00:02 - BluetoothChat] Device API version is 10 (Android 2.3.4) 
[2012-01-27 20:00:02 - BluetoothChat] Uploading BluetoothChat.apk onto device '304D1938E5584E7E' 
[2012-01-27 20:00:02 - BluetoothChat] Installing BluetoothChat.apk... 
[2012-01-27 20:00:03 - BluetoothChat] Re-installation failed due to different application signatures. 
[2012-01-27 20:00:03 - BluetoothChat] You must perform a full uninstall of the application. WARNING: This will remove the application data! 
[2012-01-27 20:00:03 - BluetoothChat] Please execute 'adb uninstall com.example.android.BluetoothChat' in a shell. 
[2012-01-27 20:00:03 - BluetoothChat] Launch canceled! 

非常感謝:)

+2

爲什麼你會期望Android 2.3.4設備具有4.0.3的功能?更重要的是,您爲什麼期望SDK能讓您編寫不會在目標設備上運行的代碼? – arootbeer 2012-01-27 18:22:11

+0

因爲我認爲minSdkVersion =「6」可以讓我在早期的版本上運行它...? – Graham 2012-01-27 19:45:08

回答

0

,因爲它說,用於爲您的手機上的BluetoothChat樣品的關鍵(可能釋放鍵?)是你正在使用運行它(的一個不同調試密鑰)。卸載手機上的應用程序(當手機不在手機上時),選擇「以Android應用程序運行」。

如果密鑰不一致,則無法升級應用程序(實質上是「如何運行Android應用程序」)。

1

目標建立你的項目應該是10在這裏,這將讓該項目在設備上運行> = API 10

+0

我想我在最小的API和目標API之間感到困惑。如果我將其更改爲10,那麼這意味着我無法使用級別> 10以上的功能。我想添加一個需要API 11的操作欄,現在如果您需要api11的操作欄,則無法使用-_- – Graham 2012-01-27 19:43:37

+0

這意味着該應用程序不會運行在<11 api即高達2.3的手機上.. – 2012-01-28 15:28:21

2
[2012-01-27 20:00:03 - BluetoothChat] Re-installation failed due to different application signatures. 
[2012-01-27 20:00:03 - BluetoothChat] You must perform a full uninstall of the application. WARNING: This will remove the application data! 

該應用程序已經存在你的設備,與一個簽名密鑰簽署。您正嘗試在另一個副本上安裝另一個具有不同簽名密鑰的應用程序(即相同的程序包)。

請從您的設備中刪除現有的BluetoothChat應用程序(例如通過設置),然後運行該應用程序。

+0

我在應用程序的手機上看到了高低,我無法找到它。然而,我的一個同事加載了一個應用程序,他直接基於藍牙聊天的例子...所以也許這是衝突的地方? – Graham 2012-01-27 19:40:26

+0

@GrahamPeyton:情況很可能如此。 Android真正跳過的是一個相同的軟件包名稱 - AndroidManifest.xml文件的''元素中的'package'屬性。在設備上(以及市場上),這必須是唯一的。如果您的同事克隆了BluetoothChat並且沒有更改軟件包名稱,那麼他將擁有與您要加載的軟件包相同的軟件包。而且,由於他會用他的簽名密鑰簽名,所以你會看到你在這裏看到的錯誤。 – CommonsWare 2012-01-27 19:48:20

+0

感謝您的幫助! – Graham 2012-01-27 19:55:59