当前位置: 首页 > news >正文

AndroidStudio下载的SDK没有tool目录,或者想要使用uiautomatorviewer工具

1.如果没有tool目录可以使用下面的地址进行下载

https://dl.google.com/android/repository/tools_r25.2.5-windows.zip

2.并且把下载的文件解压到放在AndroidStudio的目录中

3.如果使用uiautomatorviewer.bat出现下面的错误

Unable to connect to adb.Check if adb is installed correctly

找到自己的sdk根目录下platform tools 路径替换下面为本是红色的部分

@echo off
rem Copyright (C) 2012 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem don't modify the caller's environment
setlocal

rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0

rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0

rem Get the CWD as a full path with short names only (without spaces)
for %%i in ("%cd%") do set prog_dir=%%~fsi

rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF

set jarfile=uiautomatorviewer.jar
set frameworkdir=.

if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=lib

if exist %frameworkdir%\%jarfile% goto JarFileOk
    set frameworkdir=..\framework

:JarFileOk

set jarpath=%frameworkdir%\%jarfile%

if not defined ANDROID_SWT goto QueryArch
    set swt_path=%ANDROID_SWT%
    goto SwtDone

:QueryArch

    for /f "delims=" %%a in ('"%java_exe%" -jar %frameworkdir%\archquery.jar') do set swt_path=%frameworkdir%\%%a

:SwtDone

if exist "%swt_path%" goto SetPath
    echo SWT folder '%swt_path%' does not exist.
    echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
    exit /B

:SetPath
set javaextdirs=%swt_path%;%frameworkdir%

call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=D:\Program\myUtil\AdnroidSDK\platform-tools" -jar %jarpath% %*

这里替换的是platform tools 

如果出现其他错误可以看下面这一篇,因为有些东西已经重复了

https://blog.csdn.net/2301_76862031/article/details/143197170

已经可以正常使用了

http://www.dtcms.com/a/251166.html

相关文章:

  • Java网络编程深度解析
  • 实战指南:部署MinerU多模态文档解析API与Dify深度集成(实现解析PDF/JPG/PNG)
  • 大模型<闲谈>
  • 以太网交换机交换表的建立
  • 234. 回文链表
  • AI驱动SEO关键词精准布局
  • Java微服务框架技术选型全景报告
  • JSONP 跨域请求原理解析与实践
  • LeetCode--31.下一个排列
  • 【编程语言】从C++到Java到Golang,语法特性对比与开发实践指南(基础语法,类型系统,运行机制)
  • 从零开始掌握 Docker:核心命令与实践指南
  • 哈希函数结构:从MD到海绵的进化之路
  • npm install报错
  • MAZANOKE:一款隐私优先的浏览器图像优化工具及Docker部署指南
  • JVM——JVM中的扩展之道
  • ubuntu 22.04 安装部署kibana 7.10.0详细教程
  • leetcode 分割回文串 java
  • 深度对话:TensorFlow与PyTorch的API哲学——如何影响你的模型调试与生产部署?
  • Node.js 中两种模块导出方式区别
  • 数据质量-如何构建高质量的大模型数据集
  • .net6接口多个实现类使用特性标记并解析
  • JavaScript 与 Vue 键盘事件全面指南(Composition API + <script setup>)
  • [AAAI Oral] 简单通用的公平分类方法
  • WebRTC(四):STUN协议
  • Redis全面深入学习目录
  • 02-D3.js 控制横向柱图切换数据带动画效果
  • 微信小程序使用computed
  • Python文件与目录操作管理详解
  • 【系统分析师】2011年真题:综合知识-答案及详解
  • 条件收敛的级数中项必须趋于 0,正负项抵消,但趋于 0 的速度不需要“足够快”