Android錯誤異常收集

來源:互聯網
上載者:User

--------------------

今天寫一個Android程式時需要用到第三方Jar包,報了一個錯誤java.lang.NoClassDefFoundError:org.ksoap2.transport.HttpTransportSE。

查了一下資料,除了在Build Path中添加Jar包的引用是不夠的,還需要講該包加入到Source Folder。

解決辦法:

1、在項目根目錄建一個lib目錄,講Jar包負責到lib目錄中,

2、在項目右鍵Build Path的Add External Arch…添加lib中的Jar包

3、在項目右鍵Build Path的Configure Build Path的Source頁標籤點擊Add Folder按鈕,將lib目錄勾選

再次運行就不出現異常了,但bin目錄產生的apk檔案胖了不少。

--------------------------

每當匯入別人項目的時候,經常出現錯誤提示Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tool

這是因為Java編譯器的版本不正確,所以Android項目在Eclipse中會報@Overrider錯誤。

Java 1.5編譯器預設對父類的方法進行覆蓋,採用@Override進行說明;但到了1.6已經擴充到對介面的方法,所以如果還是以Java1.5編譯器來編譯就會出現錯誤。

前幾次還傻傻刪@Override,後來發現不是辦法所以找到以下方法

解決方案:

1、項目右鍵—> android tools——>Fix Project

2、項目右鍵—> Properties—>Java Compiler,確定Compiler compliance level設定為1.6,並確定勾選enable specific seetings

-----------------------------------

在運行android應用程式時可能會出現java.lang.NoClassDefFoundError: org.bouncycastle.crypto.engines.RSAEngine這樣的問題,導致程式運行直接崩潰掉。

原因:在android高版本的SDK裡面有Android Dependencies 這個目錄,它會將你引用的第三方jar包放置該目錄下,這樣才能引用你所加的類庫,但是當匯入別人的應用程式時,有可能別人是在低版本的SDK上開發的,並沒有Android
Dependencies這個目錄,所以當不能自動產生Android Dependencies目錄時,你必須手動作修改。修改如下:開啟工程的classpath檔案,添加<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>這樣的一行代碼,之後clean程式,如還沒能產生Android Dependencies 目錄,重啟一下eclipse即可完成!!!

--------------------------------------------

The builder launch configuration could not be found| Unable to resolve target 'Google Inc.:Google APIs:10'

今天匯入別人項目時遇到3個問題,解決辦法如下

1.com.google cannot be resolved

到android的sdk下的add-on裡找到map.jar,(不同版本的命名可能不同),我的路徑為

E:\Android\android-sdk\add-ons\addon-google_apis-google-15\libs\map.jar。

匯入後記要在build path中的order and export選中該包

2. Unable to resolve target 'Google Inc.:Google APIs:10'

修改目錄下的project.property檔案內容為

target=Google Inc.:Google APIs:15(注意1中,我匯入的是api15,而項目原本是api10的)

3.不能生產R檔案,看detail顯示為

The builder launch configuration could not be found.

原來是build path中的order and export勾選了不存在的jar包,所以要去掉不能識別的jar包。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.