打開eclipse時出現無法識別android的項目,即所有android項目均顯示紅色錯誤標記。點擊菜單Window的Android Virtual Device Manager 插件的標志時出現了Location of the Android SDK has not been setup in the preferences. 如下圖所示:
單擊“OK”按鈕,會出現如下對話框(沒有的話,選擇eclipse菜單Window的Preferences):
SDK Location設置正確后,仍然有“This Android SDK requires Android Developer Toolkit version 23.0.0 or above. Current version is 22.6.2.v201403212031-1085508. Please update ADT to the latest version.”的錯誤提示,這是因為SDK與ADT版本不匹配導致AVD打不開造成的。SDK更新后,adt-bundle安裝目錄\sdk\tools\lib\plugin.prop文件的內容變為“# begin plugin.propplugin.version=23.0.0# end plugin.prop”,而Eclipse在查看該文件時,查找到plugin.version=23.0.0,認為當前的sdk需要23.0.0版本以上的插件,但我們還是以前舊的22.6.2插件。
解決方法有兩種:
解決方法一:降低SDK版本
將plugin.version的版本信息改為舊版本的版本號,諸如22.6.2,保存,重啟Eclipse。
解決方法二:升級ADT版本
1.在線升級
途徑一:設置好正確的SDK Location后,重啟Eclipse時,一般情況下應該會出現如下提示升級的窗口,單擊“Check for Updates”升級;
途徑二:選擇Eclipse菜單Help -> Check for Updates 升級。
由於某些原因,谷歌的服務器總是很難連接的上的,所以如上兩種方式有可能最終出現如下失敗的提示,如何解決我也還沒找到,知道的朋友還請告訴我一下哦。
2.離線升級(其實這個服務器一樣也是很難連接得上,反正我失敗了,但網上總有熱心的人樂於分享)
下載ADT http://developer.android.com/intl/zh-CN/sdk/installing/installing-adt.html#Download
下載之后不要解壓(其實官網上已經有說明了),步驟如下:
-
- Start Eclipse, then select Help > Install New Software.
- Click Add, in the top-right corner.
- In the Add Repository dialog, click Archive.
- Select the downloaded ADT-23.0.0.zip file and click OK.
- Enter “ADT Plugin” for the name and click OK.
- In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
- In the next window, you’ll see a list of the tools to be downloaded. Click Next.
- Read and accept the license agreements, then click Finish.
If you get a security warning saying that the authenticity or validity of the software can’t be established, click OK.
-
- When the installation completes, restart Eclipse.