android(eclipse)新手常見問題總結(一)

1:jdk沒法更新
  進入工具裏面手動獲取鏡像資源 而且改成強制android

2:報錯:This version of the rendering library is more recent than your version of ADapp

  在佈局預覽中從新選擇適合你的sdk的版本工具

3:當添加文本信息有黃色感嘆號錯誤時或者報錯(I18N] Hardcoded string "this is textview", should use @string resource) 佈局

  能夠在string 添加<string name="message1">Button 2</string>  而後在在佈局裏面引用android:text="@string/message1"this

4:報錯:No Launcher activity found!  The launch will only sync the application package on the device!
  活動註冊中intent-filter 出了問題或者是其中的sdk版本不對code

5:報錯:Premature end of file.   試一下先保存再運行對象

6:報錯:The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnclickListener(){})接口

  檢查拼寫是否錯誤ip

7:添加progressdialog控件時若是setcancelabel設爲了false則必定要在代碼中dismiss(—)來關閉對話框要否則一直存在沒法取消沒法退出程序資源

8:報錯:[Accessibility] Missing contentDescription attribute on image  

  在一些沒有文本顯示的控件裏,如imageView和imageButton等,ADT會提示你定義一個android:contentDescription屬性,用來描述這個控件的做用

9:報錯:Cannot make a static reference to the non-static field ViewHolder.leftMsg
  第一種,能夠把變量改爲靜態的。第二種,先實例化對象,而後使用對象名.變量名來調用便可(我就是由於直接用了類名來調用一直出錯。。。zzz)問題

10:報錯:OnClickListener cannot be resolved to a type
  將「new OnClickListener」改成「new View.OnClickListener」,由於android版本升級後,將「OnClickListener」接口移到了View類中
  或者是導入import android.view.View.OnClickListener;或者是拼寫錯誤

11:The connection to adb is down, and a severe error has occured.

  我遇到的問題是端口占用,能夠採用netstat -ano查看是否有其餘程序佔用啓動android adb須要的通訊端口,我當時是由於安裝了兩個手機助手,卸載了一個就行了。

相關文章
相關標籤/搜索