Android常見錯誤處理

來源:互聯網
上載者:User

1.匯入項目報錯

在Eclipse中匯入一個已存在的項目時,經常出現Android版本不匹配錯誤。

解決方案:右單擊項目節點,選擇Properties命令,在Android的Project Build Target中選擇合適的Target即可。

圖 1‑52 項目Properties對話方塊

2.@Override報錯

代碼中@Override提示錯誤。

解決方案:Eclispe ->Windows -> Preferences -> java -> Compiler -> compiler compliance level設為1.6或更高版本。

3.Unable to execute dex: wrapper was not properly loaded first錯誤

在Eclipse中運行Android項目是報錯。

解決方案:Eclipse目錄下eclipse.ini最後兩句改為-Xms128m  -Xmx512m重啟eclipse然後project->clean。

4.Your project contains error(s),please fix them before running your application

運行項目時,提示如下錯誤,項目的檔案卻沒有錯誤:

圖 1‑53 AndroidLaunch錯誤提示

查看Problems視窗顯示如下:

圖 1‑54 Problems視窗

提示資訊為無法產生最終的文檔apk,因為Debug驗證已經到期了。

解決方案:右單擊項目根節點,執行preference->android->buid命令,顯示如下視窗:

圖 1‑55 項目Preference對話方塊

找到debug.keystore檔案所在位置並刪除,然後重新Clean項目並編譯運行(Eclipse會重建debug.keystore)即可。

原因分析:Android要求所有的程式必須有簽名,否則就不會安裝該程式。在開發過程中,ADT使用debug keystore,其預設有效期間為一年,如果出現debug keystore到期,將導致無法產生apk檔案。

5.Failed to rename directory E:\android\tools toE:\android\temp\ToolPackage.old01問題

解決方案:將temp檔案夾下的ToolPackage.new01改名為tools,將temp下新得到的tools檔案夾(如果是壓縮檔,解壓即可)拷到SDK的根目錄下,覆蓋原來的tools檔案夾。最後,重啟SDK Manager.exe,再進行更新即可。

6.Unable to find a 'userdata.img' file for ABI armeabi to copy intothe AVD folder.

原因分析:AndroidSDK Manager沒安裝完全(特別是ARMEABI ** System Image沒有安裝)。解決方案:重啟SDK Manager.exe,完成預設檔案的安裝。

7.Android添加工程時出現This template depends on the Android Support library.

解決方案:關閉eclipse,結束adb.exe進程,進入\extras\android之後,沒有support檔案夾但是有一個compatibility檔案夾。建立support檔案夾,將compatibility裡面的東西複製到support裡面,重新啟動eclipse。

8.An error occurred while automatically activating bundlecom.android.ide.eclipse.adt

解決方案:在命令列下面進入到eclipse目錄下用eclipse.exe -clean啟動eclipse。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.