- 1、本文档共43页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
android 调试笔记概要1
android 调试笔记
adb使用:
连接不上手机开发
c:\users\administrator\.android\adb_usb.ini ? 增加一行内容: ?0x1782
安装第三方应用开发
? ?$ adb install apk文件名2.安装系统开发应用开发$ adb remount$ adb push apk文件名 /system/app// apk文件名形如testme.apk
卸载应用开发程序
1.$ adb uninstall 包名 例如:adb uninstall lee.study
2. 在终端上找到:home-设置-应用开发程序-管理应用程序-选择某应用开发程序-卸载
设置属性值
使用adb shell: ? 改成中文?setprop persist.sys.language zh;setprop persist.sys.country cn;stop;sleep 5;start
注解: ?setprop persist.sys.language zh(mcc: mobile country code);setprop persist.sys.country cn(mnc: mobile network code);
?stop;sleep 5;start ?延时5秒重启机器
查看系统开发定义所有权限列表:
?adb shell pm list permissions
模拟按键
adb shell input keyevent 3 ? ? :模拟home键 ?3 =?keyevent.keycode_home
adb server is out of date. ?killing... ??解决措施:
描述:adb server is out of date. ?killing...?adb server didnt ack* failed to start daemon *error: unknown host service
究其源就是adb server没启动 解决开发过程?分析整理如下:e:\adb nodaemon server ?cannot bind tcp:5037 ?原来adb server 端口绑定失败继续查看到底是哪个端口给占用了e:\netstat -ano | findstr 5037 ?? tcp ? ?:4112 ? ? ? ? :5037 ? ? ? ? close_wait ? ? ?2960? tcp ? ?:5037 ? ? ? ? :0 ? ? ? ? ? ? ?listening ? ? ? 4596? tcp ? ?:5037 ? ? ? ? :3006 ? ? ? ? established ? ? 4596? tcp ? ?:6149 ? ? ? ? :5037 ? ? ? ? close_wait ? ? ?2960打开任务管理器kill掉4596 这个进程。ok
解决读取权限问题
例如 使用adb push init.rc / ? ? ? 命令时报错:unable to chmod init.rc: read-only file system
在shell命令行中输入adb root切换到root用户然后执行如下命令:(注意,/表示的是根目录,因此这个不仅仅是对sdcard,其他文件也可以读写。rw表示读写权限,mount重挂载文件系统开发)adb shell mount -o remount rw /?执行完后,可以用mount命令查看,当前挂载的文件系统开发权限如何,可以看出都有读写权限了(rw
?
?
代码中安装apk
[plain]?view plaincopy
?
runtime.getruntime().exec(pm?install?xxx.apk);???
需要在manifest.xml文件中,加上install_packages的权限,可以用?package install的receiver来处理安装成功后的操作
或者:
? ? ?/**?
?????*?安装apk?
?????*?@param?url?
?????*/??
????private?void?installapk(){??
????????file?apkfile?=?new?file(savefilename);??
????????if?(!apkfile.exists())?{??
????????????return;??
????????}??????
????????intent?i?=?new?intent(intent.action_view);??
????????i.setdataandtype(u
文档评论(0)