Android 开发过程笔记

来源:互联网 发布:景观大数据破解 编辑:程序博客网 时间:2024/06/14 00:21

一. R.java

1. R.java 文件是自动生成的,因此手动编辑没用

在strings.xml文件中声明的所有</string>都对应于R.java 中的public static final class string中的一个public static final int属性


2.R.java 中的public static final class layout中会包含所有的布局文件。

一般而言,新建android project之后会自动生成一对Activity和layout文件,之后新建的Activity,用以下方式来新建一个布局文件。

项目->res->layout->new->Android XML File


3.R.java 中的public static final class id包含所有在布局页面上的控件

4.有时候当使用R.id.* 等时,会提示cannot be resolved的错误,看看是不是有类似 import android.R.*; 的问题



二. adb.exe 问题

1.出现错误:

1)adb server does not ACK

The connection to adb is down, and a severe error has occured. 
You must restart adb and Eclipse. 
Please ensure that adb is correctly located at 'D:\android-2.2-windows\tools\adb.exe' and can be executed. 

2)adb server is out of date. killing

错误原因:adb 的5037端口被占,以致adb 服务器启动不了。

错误分析过程:

cmd转到android的sdk下的platform-tools目录下

1)使用adb nodaemon server 可以查询服务器状态

结果如果是  cannot bind ‘tcp:5037’就说明端口被占

2)使用命令netstat -ano | findstr "5037" 查询与5037端口相关的进程

在任务管理器里头结束5037端口监听(LISTENING)的进程即可。

2.观察占用5037端口的进程,可能是tadb.exe 这个是腾讯安全管家管理手机相关的程序,在安装了腾讯手机安全管家后,一旦启动QQ,该进程便会启动,占用端口,因此做开发的话,建议不要安装这个(一些手机连接、管理软件之类的,豌豆荚等,建议也别安装)。要不几乎每次都要手机关闭这个进程,很烦。

原创粉丝点击