[英]Uiautomatorviewer.bat removed from Android SDK?
I wanted to use the uiautomatorviewer.bat<\/code> today, but when I clicked on it, it removed itself.
我今天想使用
uiautomatorviewer.bat<\/code> ,但是当我单击它时,它会自行删除。
This typically happens when there is an update to the file and somehow Android Studio recognizes this.这通常发生在文件有更新并且 Android Studio 以某种方式识别这一点时。 Is the
layout inspector<\/code> now the replacement for the
uiautomatorviewer<\/code> ?
layout inspector<\/code>器现在是
uiautomatorviewer<\/code>的替代品吗?
Since the documentation still mentions the tool, eg https:\/\/developer.android.com\/training\/testing\/ui-automator<\/a> , I am not sure.由于文档仍然提到该工具,例如https:\/\/developer.android.com\/training\/testing\/ui-automator<\/a> ,我不确定。 There are still several versions of the
uiautomator.jar<\/code> shipped with the Android-SDK, eg in
Android\\Sdk\\platforms\\android-30\\<\/code> and in
Android\\Sdk\\tools\\lib\\<\/code> for instance.
仍然有几个版本的
uiautomator.jar<\/code>随 Android-SDK 一起提供,例如在
Android\\Sdk\\platforms\\android-30\\<\/code>和
Android\\Sdk\\tools\\lib\\<\/code>中。
But of course, you can't directly invoke the JAR file, as certain dependencies (paths) are missing.但当然,您不能直接调用 JAR 文件,因为缺少某些依赖项(路径)。 I tried to use some old
uiautomatorviewer.bat<\/code> , but can't place it into
Android\\Sdk\\tools\\bin\\<\/code> due to permission issues.
我尝试使用一些旧的
uiautomatorviewer.bat<\/code> ,但由于权限问题无法将其放入
Android\\Sdk\\tools\\bin\\<\/code>中。
Adjusting the paths would be a mess.调整路径将是一团糟。 I'd like to use
uiautomatorviewer<\/code> over the
layout inspector<\/code> due to certain information, which I couldn't locate in the output of the
layout inspector<\/code> .
由于某些信息,我想在
layout inspector<\/code>器上使用
uiautomatorviewer<\/code> ,但我无法在
layout inspector<\/code>器的输出中找到这些信息。
"
Since the uiautomatorviewer.bat
isn't available anymore in the latest Android SDKs, I have created my own version of it:由于uiautomatorviewer.bat
在最新的 Android SDK 中不再可用,我创建了自己的版本:
@echo off
rem don't modify the caller's environment
setlocal
set prog_dir=E:\Android\Android\Sdk\tools
rem depends on your environment, either x86_64 or x86
set swt_path=E:\Android\Android\Sdk\tools\lib\x86_64
set frameworkdir=E:\Android\Android\Sdk\tools\lib
set jarfile=uiautomatorviewer-26.0.0-dev.jar
set jarpath=%frameworkdir%\%jarfile%
rem we need to use Java8 otherwise the option -Djava.ext.dirs= is not available anymore
set java_exe=C:\Program Files\Java\jdk1.8.0_181\bin\java.exe
set javaextdirs=%swt_path%;%frameworkdir%
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*
You just need to adjust the paths accordingly.您只需要相应地调整路径。 An even better approach would be to refactor the script using the env variable ANDROID_HOME
.更好的方法是使用环境变量ANDROID_HOME
重构脚本。 Note: You can't use any java version > 1.8 , because the option -Djava.ext.dirs
is not supported anymore in those versions.注意:您不能使用任何java 版本 > 1.8 ,因为这些版本不再支持选项-Djava.ext.dirs
。
In my setup I was needed to add some changes to @auermich .bat The problem was in usage of Program Files as home for Android SDK在我的设置中,我需要对@auermich .bat 添加一些更改问题在于将程序文件用作Android SDK 的主页
@echo off
setlocal
set prog_dir=C:\Program Files\Android\androidSdkWindows\tools
set swt_path=C:\Program Files\Android\androidSdkWindows\tools\lib\x86_64
set frameworkdir=C:\Program Files\Android\androidSdkWindows\tools\lib
set jarpath="C:\Program Files\Android\androidSdkWindows\tools\lib\uiautomatorviewer-26.0.0-dev.jar"
set java_exe=C:\Program Files\Java\jdk1.8.0_202\bin\java.exe
set javaextdirs=%swt_path%;%frameworkdir%
call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.