求助,打开uiautomatorviewer.bat 提示没连接到adb,可是我读端口是有的

小白兔11 2015-09-06 11:43:12
...全文
2907 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Psycho.W 2019-07-24
  • 打赏
  • 举报
回复
引用 5 楼 paddysp 的回复:
1、把uiautomatorviewer.bat移动到和adb.exe同一目录下(即platform-tools)
2、编辑uiautomatorviewer.bat、把第32行call的目录改成..\tools\lib\find_java.bat
把第39行frameworkdir改成..\tools\lib

成功使用后把uiautomatorviewer.bat复制一份备份,因为有时候这个文件会莫名其妙消失

太厉害了!
paddysp 2017-06-28
  • 打赏
  • 举报
回复
1、把uiautomatorviewer.bat移动到和adb.exe同一目录下(即platform-tools) 2、编辑uiautomatorviewer.bat、把第32行call的目录改成..\tools\lib\find_java.bat 把第39行frameworkdir改成..\tools\lib 成功使用后把uiautomatorviewer.bat复制一份备份,因为有时候这个文件会莫名其妙消失
m0_37992531 2017-04-21
  • 打赏
  • 举报
回复
你好,有答案吗
小暖or晶晶 2017-02-28
  • 打赏
  • 举报
回复
同求此问题答案
alex_sijin 2016-11-17
  • 打赏
  • 举报
回复
你是用源码运行的吗如果是源码运行的我这有个方法可以
1.导入源码找到包com.android.uiautomator
2.在com.android.uiautomator包下有一个DebugBridge.java
3.打开这个java类找到private static String getAdbLocation()方法
4.修改代码如下 亲测有效欢迎大家一起沟通
private static String getAdbLocation() {

// String toolsDir = System.getProperty("com.android.uiautomator.bindir"); //$NON-NLS-1$ 这样是获取不到 adb的
// if (toolsDir == null) {
// return null;
// }
String toolsDir = "D:\\adt-bundle-windows-x86-20131030\\sdk\\tools"; //本机adb位置

File sdk = new File(toolsDir).getParentFile();

// check if adb is present in platform-tools
File platformTools = new File(sdk, "platform-tools");
File adb = new File(platformTools, SdkConstants.FN_ADB);
if (adb.exists()) {
return adb.getAbsolutePath();
}

// check if adb is present in the tools directory
adb = new File(toolsDir, SdkConstants.FN_ADB);
if (adb.exists()) {
return adb.getAbsolutePath();
}

// check if we're in the Android source tree where adb is in $ANDROID_HOST_OUT/bin/adb
String androidOut = System.getenv("ANDROID_HOST_OUT");
if (androidOut != null) {
String adbLocation = androidOut + File.separator + "bin" + File.separator +
SdkConstants.FN_ADB;
if (new File(adbLocation).exists()) {
return adbLocation;
}
}

return null;
}
qiaoxiang 2016-10-10
  • 打赏
  • 举报
回复
请问解决了吗?

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧