Android錯誤解決方案集

來源:互聯網
上載者:User

標籤:android

1 android java.net.UnknownHostException: Unable to resolve host “…”: No address associated 錯誤

我在android開發的時候經常會遇到這個錯誤,一般來說,造成這種錯誤的最普遍情況有兩種:

1.android裝置網路連接沒開啟,例如3G網路和WIFI網路

所以,如果遇到這種錯誤時,請先查看網路是否已正常串連.

2.Manifest檔案沒有標明網路存取權限

如果確認網路已經正常串連並且還是出這種錯誤的話,那麼請看下你的Manifest檔案是否標明應用需要網路存取權限,如果沒標明的話,也訪問不了網路,也會造成這種情況的.

//網路存取權限

2 Failed to install *.apk on device ‘emulator-5554′: timeout

錯誤提示:

Failed to install helloworld.apk on device ‘emulator-5554′: timeout

或者

the user data image is used

原因:

由於模擬器已經開啟而沒有關閉或者非法關閉引起的。

解決方案:

刪除 C:Documents and SettingsAdministrator.androidavd對應版本.avd

下所有以.lock結尾的檔案夾。

或者

Failed to install *.apk on device *:

timeout Launch canceled!

還有一種辦法:

在window->preferences->Android->DDMS->ADB connection time out (ms):

將這個值設定的大一些,預設為5000,設定成500000,然後就OK了。

3 This Android SDK requires Andriod Developer Toolkit version 20.0.0 or above

開啟Eclipse(Android 開發環境),發現以下報錯:

圖片顯示資訊為:Android SDK要求ADT(Android Developer Toolkit)版本在20.0.0或以上版本,檢測到目前的版本為18.0.0,請更新最新的ADT。

出現這樣的提示,根本原因是Eclipse啟動時檢測E:Program Filesandroid-sdk-windowstoolslibplugin.prop檔案 檔案內容為:

begin plugin.prop

plugin.version=20.0.0

# end plugin.prop

這就很容易理解了,需求外掛程式版本為20.0.0,這時候我們只需要改成:

begin plugin.prop

plugin.version=18.0.0

# end plugin.prop

OK了,重新啟動下Eclipse,看看是不是解決了這個問題

4 [Accessibility] Missing contentDescription attribute on image

今天使用了下ADT 16.0 在定義一個ImageVIew的時候 總是提示這個[Accessibility] Missing contentDescription attribute on image警告,雖說可以不理 但總是感覺怪怪的,在網上一搜 發現原來這是ADT 16.0的新特性,在一些沒有文本顯示的控制項裡,如imageView和imageButton等,ADT會提示你定義一個android:contentDescription屬性,用來描述這個控制項的作用。英文原文如下,如有翻譯的不對的地方,敬請批評指正。

Resolved this warning by setting attribute android:contentDescription for my ImageView

android:contentDescription=”@string/desc”

Android Lint support in ADT 16 throws this warning to ensure that image widgets provide a contentDescription

This defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.

Non-textual widgets like ImageViews and ImageButtons should use the contentDescription attribute to specify a textual description of the widget such that screen readers and other accessibility tools can adequately describe the user interface.

5 java.lang.NoClassDefFoundError: com.baidu.mapapi.BMapManager解決辦法

用百度地圖,可能把工程複製了些位置 出錯了

解決辦法:

1.右擊項目->properties->Java Build Path->Order and Export,在需要引用的包前面打勾。

2.Project->Clean…

6 eclipse中提示 No Completions Available,Alt+/不自動提示

window-> Preferences-> Java-> Editor-> Content Assist-> Advanced

上面的選項卡Select the proposal kinds contained in the ‘default’ content assist list中添加【Java Non-Type Proposals】

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.