Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 尝试使用uiautomatorviewer时无法检测adb版本,无退出值_Android_Automation_Adb_Android Sdk Tools - Fatal编程技术网

Android 尝试使用uiautomatorviewer时无法检测adb版本,无退出值

Android 尝试使用uiautomatorviewer时无法检测adb版本,无退出值,android,automation,adb,android-sdk-tools,Android,Automation,Adb,Android Sdk Tools,我正在尝试使用uiautomatorviewer捕获通过usb连接的Android设备。 我已卸载Android SDK并重新安装。我对adb命令(如安装或连接等)没有任何问题。正如您在下面看到的,我可以看到附加了adb设备命令的设备,并且在使用adb版本命令时可以看到adb版本。问题是,当我启动uiautomatorviewer时,我遇到了 无法检测adb版本,adb输出: 在这一点上,没有其他事情发生,程序也没有连接到我的设备 PS C:\Windows\system32> adb d

我正在尝试使用uiautomatorviewer捕获通过usb连接的Android设备。 我已卸载Android SDK并重新安装。我对adb命令(如安装或连接等)没有任何问题。正如您在下面看到的,我可以看到附加了adb设备命令的设备,并且在使用adb版本命令时可以看到adb版本。问题是,当我启动uiautomatorviewer时,我遇到了 无法检测adb版本,adb输出: 在这一点上,没有其他事情发生,程序也没有连接到我的设备

PS C:\Windows\system32> adb devices
List of devices attached
a2738481        device

PS C:\Windows\system32> adb version
Android Debug Bridge version 1.0.41
Version 30.0.3-6597393
Installed as C:\android-sdk\platform-tools\adb.exe
PS C:\Windows\system32> uiautomatorviewer
03:55:06 E/adb: Unable to detect adb version, adb output:
Terminate batch job (Y/N)? y
PS C:\Windows\system32>
认为我的uiautomatorviewer.bat文件可能有问题

@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

for /f %%a in ("%APP_HOME%\lib\uiautomatorviewer-26.0.0-dev.jar") do set jarfile=%%~nxa
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 ('%frameworkdir%\..\bin\archquery') 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=C:\android-sdk\tools" -jar %jarpath% %*

请注意,当我在C:\android sdk\tools中运行monitor.bat时,它不会出现任何问题

-我删除并重新安装了android sdk -我试过以前的SDK -尝试了powershell和命令提示符 -删除和添加环境变量的路径 唯一能最终解决我的问题的是重新安装windows。
但是,嘿,至少现在它起作用了

-我删除并重新安装了Android SDK -我试过以前的SDK -尝试了powershell和命令提示符 -删除和添加环境变量的路径 唯一能最终解决我的问题的是重新安装windows。 但是,嘿,至少现在它起作用了