uiautomatorviewer 无法执行
# uiautomatorviewer.bat 需要 java 8.0 
$programDir = ${env:ProgramFiles(x86)}
$javaDir = [System.IO.Path]::Combine($programDir, 'Java\jre-1.8')
$javaBin = [System.IO.Path]::Combine($javaDir, 'bin', 'java.exe')

if(-not [System.IO.File]::Exists($javaBin)) {
    throw [System.IO.FileNotFoundException]::new("java 路径不存在:$javaBin")
}

$env:JAVA_HOME = $javaDir
Write-Output  "java 目录: $($env:JAVA_HOME)" 

$appDir = $env:localappdata
$appBinDir = [System.IO.Path]::Combine($appDir, 'Android\Sdk\tools\bin')
$appBin = [System.IO.Path]::Combine($appBinDir, 'uiautomatorviewer.bat')

if(-not [System.IO.File]::Exists($appBin)) {
    throw [System.IO.FileNotFoundException]::new("启动脚本不存在:$appBin")
}

Set-Location $appBinDir

Write-Output "执行脚本: $appBin"

& $appBin
上一篇
下一篇