Android實戰技巧之九:最新Android開發環境(Eclipse+ADT+Android 5.0),androidadt

來源:互聯網
上載者:User

Android實戰技巧之九:最新Android開發環境(Eclipse+ADT+Android 5.0),androidadt
一、一切由執行階段錯誤引起dalvikvm Could not find class '引用包.類', referenced from method...

其實在編譯時間也會見到如下錯誤:
       [dx]
       [dx] trouble processing:
       [dx] bad class file magic (cafebabe) or version (0033.0000)
       [dx] ...while parsing com/novell/sasl/client/DigestChallenge.class
       [dx] ...while processing com/novell/sasl/client/DigestChallenge.class
二、嘗試1.使用JDK7
有推薦使用JDK7來解決類似問題的文章,可是我照做並沒有解決問題。
2.升級build-tools
先來說說我的開發環境吧。
那是在2013年末配置的環境,ADT大版本號碼是22,tools大版本號碼也是22,Plantform-tools已經是最新的21,build-tools是18.1.1。
經過同事的實踐,問題應該歸咎於build-tools版本低的緣故。
三、最新開發環境的搭建(Eclipse & ADT&SDK)1.各tools的升級這裡我們要重新設定一下代理,去neusoft.edu.cn鏡像網站中下載最新的工具和SDK。

啟動 Android SDK Manager(命令列中直接輸入android),Tools--->Options...,彈出Android SDK Manager - Settings視窗;在HTTP Proxy Server和HTTP Proxy Port輸入框內填入mirror.neusoft.edu.cn(注意沒有http等首碼)和80,並且選中Force https://... sources to be fetched using http://...複選框。 再選擇Packages--->Reload。

此時會發現我們順利的取到Packages了,那麼我們盡情下載吧。除了最新的Android 5.0.1還沒有提供,其他的一應俱全了。

tools更新到最新是24.0.2,

build-tools我選擇了19.1、20和21.1.2,分別對應API19(4.4.2)、API20(L)和API21(5.0).

Android 5.0全部選擇。

2.ADT的升級由於更tools升級到最新,那麼ADT22已經到期了,需要使用23及以上版本的ADT。找到好心人上傳的23.03,安裝時發現eclipse版本不支援最新的ADT(我使用的Juno),好吧,既然這樣就都來新的吧。
3.eclipse luna最新的版本是luna,還是130多兆。解壓後直接啟動。
4.再次安裝ADT這時在Help--->Install New Software --->Add, 選擇ADT23.03 ZIP包,將“Contact all update sites during install to find required software.”勾選掉。
繼續完成安裝。

一切準備就緒,將之前有問題的項目引入進來,編譯,出現記憶體方面的問題。
四、dex的問題出現了兩個問題:
1.unable to execute dex:java heap space
2.Conversion to Dalvik format failed: Unable to execute dex: GC overhead limit exceeded
配置eclipse.ini,將Xms40m和Xmx512m修改成126m和1024m,這個值要根據自己機器配置調整,只要運行良好就ok。
$ cat eclipse.ini -startupplugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar--launcher.libraryplugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326-productorg.eclipse.epp.package.java.product--launcher.defaultActionopenFile-showsplashorg.eclipse.platform--launcher.XXMaxPermSize256m--launcher.defaultActionopenFile--launcher.appendVmargs-vmargs-Dosgi.requiredJavaVersion=1.6-XX:MaxPermSize=256m-Xms126m-Xmx1028m

重啟、clean項目,編譯,通過!運行,正常!至此我的最新Android開發環境搭建完成。
五、結論時刻保持與時俱進的心態,穩定的新工具對我們的工作益處多多。

聯繫我們

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