我试图在模拟器上运行谷歌地图v2,我正在遵循本教程。
当我试图在模拟器上安装所需的apk文件时,我得到以下错误。
我尝试使用本教程来解决这个问题。按照所有步骤,将path to paltform-tools添加到environment path。此外,在修改PATH变量后,启动了一个新的CommandPrompt窗口。
但是得到相同的错误。我需要在模拟器上检查我的谷歌地图应用程序。
请给我建议。
'adb' is not recognized as an internal or external command,
operable program or batch file.
我建议您使用PowerShell
设置Android Studio终端为PowerShell:
Settings > Tools > Terminal > Shell path = pwsh.exe (instead of cmd.exe)
在Android Studio上打开终端
PowerShell 7.0.1
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/powershell
Type 'help' to get help.
PS >
测试adb.exe的路径
# `pikachu` should be replace your username
PS > test-path "C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"
True
在文本编辑器中打开powershell配置文件
PS > notepad $profile
添加以下行,保存并退出
# `pikachu` should be replaced with your username
$env:PATH+=";C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"
重新打开终端并尝试adb
PS > adb
Android Debug Bridge version 1.0.41
Version 30.0.1-6435776
Installed as C:\Users\hdformat\AppData\Local\Android\sdk\platform-tools\adb.exe
global options:
-a listen on all network interfaces, not just localhost
-d use USB device (error if multiple devices connected)
-e use TCP/IP device (error if multiple TCP/IP devices available)
-s SERIAL use device with given serial (overrides $ANDROID_SERIAL)
-t ID use device with given transport id
-H name of adb server host [default=localhost]
-P port of adb server [default=5037]
我建议您使用PowerShell
设置Android Studio终端为PowerShell:
Settings > Tools > Terminal > Shell path = pwsh.exe (instead of cmd.exe)
在Android Studio上打开终端
PowerShell 7.0.1
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/powershell
Type 'help' to get help.
PS >
测试adb.exe的路径
# `pikachu` should be replace your username
PS > test-path "C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"
True
在文本编辑器中打开powershell配置文件
PS > notepad $profile
添加以下行,保存并退出
# `pikachu` should be replaced with your username
$env:PATH+=";C:\Users\pikachu\AppData\Local\Android\sdk\platform-tools"
重新打开终端并尝试adb
PS > adb
Android Debug Bridge version 1.0.41
Version 30.0.1-6435776
Installed as C:\Users\hdformat\AppData\Local\Android\sdk\platform-tools\adb.exe
global options:
-a listen on all network interfaces, not just localhost
-d use USB device (error if multiple devices connected)
-e use TCP/IP device (error if multiple TCP/IP devices available)
-s SERIAL use device with given serial (overrides $ANDROID_SERIAL)
-t ID use device with given transport id
-H name of adb server host [default=localhost]
-P port of adb server [default=5037]