天天看点

当Android项目不运行时,可能出现这种状况 EditText的inputtype属性

一、   用Eclipse编译android程序时,出现警告This text field does not specify an inputType or a hint  

  <EditText

        android:id="@+id/factorTwo"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content" 

        />

错误原因:没有给EditText编辑设置inputtype属性

修改:

    <EditText

        android:id="@+id/factorOne"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:inputType="number|phone"

        android:text=""       

        />

出现错误:Android:This text field does not specify an inputType or a hint

android开发过程中突然发现的warning  EditText 报出 “This text field does not specify an inputType or a hint”

原因:

EditText需要指定默认输入类型

加入android:inputType="number|phone",表示指定为数字或电话

inputtype类型如下:

//文本类型,多为大写、小写和数字符号。

android:inputType="none"

android:inputType="text"

android:inputType="textCapCharacters"

android:inputType="textCapWords"

android:inputType="textCapSentences"

android:inputType="textAutoCorrect"

android:inputType="textAutoComplete"

android:inputType="textMultiLine"

android:inputType="textImeMultiLine"

android:inputType="textNoSuggestions"

android:inputType="textUri"

android:inputType="textEmailAddress"

android:inputType="textEmailSubject"

android:inputType="textShortMessage"

android:inputType="textLongMessage"

android:inputType="textPersonName"

android:inputType="textPostalAddress"

android:inputType="textPassword"

android:inputType="textVisiblePassword"

android:inputType="textWebEditText"

android:inputType="textFilter"

android:inputType="textPhonetic"

//数值类型

android:inputType="number"

android:inputType="numberSigned"

android:inputType="numberDecimal"

android:inputType="phone"//拨号键盘

android:inputType="datetime"

android:inputType="date"//日期键盘

android:inputType="time"//时间键盘

二、关闭myeclipse时出现的警告框“ always exit without prompt ”是总是退出不提示”就是问你是不是在下次关闭的时候不再弹出这个的对话框,直接关闭

 三、启动android模拟器时.有时会报The connection to adb is down, and a severe error has occured.的错误.在网友说在任务管理器上把所有adb.exe关闭掉.重启eclipse.但试过不管用.所以在外国网站上找到一种可行的方法:

1.先把eclipse关闭.

2.在管理器转到你的android SDK 的platform-tools下, 

3.键入adb kill-server ,如果adb关闭了会提示 server not running *

4.再输入 adb start-server  如果不成功会提示 daemon not running. starting it now on port  ***的

   而如果成功的话不提示任何语句的.这时再重新打开eclipse就可以正常运行模拟器的了.

you must restart adb and eclipse的相关解决办法

1,关闭eclipse并在进程中杀掉adb.exe,然后重启。

2,如有真机连接,拔掉真机,重复1的步骤,

3,关掉eclipse,然后在命令行运行如下命令

      adb kill-server

      adb start-server

      然后重启eclipse

 四、总结:[2013-07-23 17:28:06 - ] The connection to adb is down, and a severe error has occured.

                     [2013-07-23 17:28:06 - ] You must restart adb and Eclipse.

                     [2013-07-23 17:28:06 - ] Please ensure that adb is correctly located at 'D:\Program Files\Android\android-sdk\platform-tools\adb.exe' and can be executed.

     看上面的信息说是没有连上adb,需要重启adb,然后确认adb的位置是否正确。

1、解决问题根据问题描述,是这解决问题。

查看“任务管理器”进程,发现根本就没有adb这个进程;

然后重启adb,发现没效果,adb无法启动;

最后确认adb所在位置,adb位置正确。然后我就没辙了。

2、百度、谷歌

自己找不到办法,当然就去求助百度、谷歌喽。

搜寻结果有两种:

第一种,大多说的是任务管理器 kill掉adb 或者重启adb server

第二种,说是豌豆荚进程占用了adb端口,在任务管理器kill掉wandoujia_daemon.exe ,就可以了。

3、搜索结果分析

对于第一种结果,之前就说了根本就没adb进程,行不通;

对于第二种结果,我根本就没装过豌豆荚,非常不靠谱,但是adb端口被占用倒是很有可能。

4、根据分析结果继续搜索百度、谷歌

终于让我百度发现一个解决方法。

前提:我任务管理器就没有adb ,猜测是某个程序占用了adb端口。

查找资料得知,5037为adb默认端口,所以查看该端口情况如下:

       netstat -aon|findstr "5037"       TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING  

     11248发现7852占用了 5037端口,继续查看7852的进程,发现是tadb  .如下所示

        tasklist|findstr "7285"        tadb.exe                     11248 Console                    1      5,236 K

接下来问题就好解决了,在任务管理器杀掉tadb.exe ,重启adb,ok,问题解决 。