터미널을 통해 OS X에서 adb에 액세스 할 수 없습니다 (“명령을 찾을 수 없음”).
Mac 시스템에 Android SDK 및 Eclipse를 설치했습니다. Eclipse를 사용하여 프로그래밍하고 샘플 응용 프로그램을 거의 만들지 않았습니다. 그러나 여전히 adb
터미널 창을 통해 액세스 할 수 없습니다 . 터미널에서 다음 명령을 시도했습니다.
$ pwd
/Users/espireinfolabs/Desktop/soft/android-sdk-mac_x86/platform-tools
$ ls
NOTICE.txt dexdump llvm-rs-cc-2
aapt dx llvm-rs-cc.txt
adb lib source.properties
aidl llvm-rs-cc
$ adb --help
-bash: adb: command not found
또한 내가 ls
어느 창에 있는지 알 수 있도록 출력 을 추가했습니다 .
adb
에 없습니다 PATH
. 쉘이 실행 파일을 찾는 곳입니다. 로 전류 PATH
를 확인할 수 있습니다 echo $PATH
.
Bash는 먼저 adb
현재 디렉토리가 아닌 경로에서 이진 파일을 찾습니다 . 따라서 현재 platform-tools
디렉토리 에 있다면 전화하십시오.
./adb --help
점은 현재 디렉토리이며, Bash가 adb
거기 에서 사용하도록 지시 합니다.
그렇지 않으면, 당신은 추가해야합니다 platform-tools
당신에게 PATH
, 쉘 프로파일에 경로를 추가하여, 파일 사용에 따라 :
- 리눅스 : 일반적으로
~/.bashrc
- OS X / macOS : 일반적으로
~/.profile
또는~/.bash_profile
다음 줄을 추가하고 경로를 설치 한 경로로 바꾸십시오 platform-tools
.
export PATH=/Users/espireinfolabs/Desktop/soft/android-sdk-mac_x86/platform-tools:$PATH
프로파일 파일을 저장 한 후 터미널을 다시 시작하거나 실행하십시오 source ~/.bashrc
(또는 방금 수정 한 것).
플랫폼 도구를 다른 곳에 설치 한 경우 경로를 적절히 변경하십시오. 예를 들어, OS X의 Android Studio의 경우 다음을 사용합니다. 가능한 공간이 경로 구문을 손상시키지 못하게하는 큰 따옴표를 참고하십시오.
export PATH="/Users/myuser/Library/Android/sdk/platform-tools":$PATH
slhck 외에도 이것이 나를 위해 일한 것입니다 (mac).
SDK가 어디에 있는지 확인하십시오.
- Android 스튜디오를 열고 다음으로 이동하십시오.
파일-> 프로젝트 구조-> SDK 위치
경로를 복사하십시오.
.bash_profile
집에 숨겨진 것을 만드십시오 .- (
vim
또는로 열림open -e
) 다음을 사용하십시오.
export PATH=/Users/<Your session name>/Library/Android/sdk/platform-tools:/Users/<Your session name>/Library/Android/sdk/tools:$PATH
- 그런 다음 터미널에서 간단히 사용하십시오.
. ~/.bash_profile
빠른 답변
이 명령을 터미널에 붙여 넣으면 대부분의 경우 문제가 해결됩니다.
** 현재 터미널 세션 :
- (MacOS에서) export PATH = "~ / Library / Android / sdk / platform-tools": $ PATH
- (Windows에서) 최대한 빨리 업데이트합니다
** 영구적으로 :
- (macOS에서)
~/.bash_profile
using을 편집하고vi ~/.bash_profile
다음 줄을 추가하십시오 : export PATH = "~ / Library / Android / sdk / platform-tools": $ PATH
그러나 그렇지 않은 경우 계속 읽으십시오.
자세한 답변
Android Debug Bridge 또는 adb 는 일반적으로 플랫폼 도구에 있으며 Android SDK 와 함께 제공됩니다 . 시스템 경로에 해당 위치를 추가하기 만하면됩니다. 따라서 시스템은 그것에 대해 알고 있으며 필요한 경우 사용할 수 있습니다.
ADB의 위치 찾기
이 폴더의 경로는 설치 시나리오에 따라 다르지만 일반적인 경로는 다음과 같습니다.
- Android Studio를 설치 한 경우 ADB 경로는 다음과 같습니다. (가장 일반적)
- (macOS에서) ~ / Library / Android / sdk / platform-tools
- (Windows에서) 최대한 빨리 업데이트합니다
다른 곳에 Android Studio를 설치 한 경우 다음 으로 이동하여 위치를 결정하십시오.
- (in macOS) Android Studio > Preferences > Appearance And Behavior > System Settings > Android SDK and pay attention to the box that says: Android SDK Location
- (in Windows) i will update asap
- However Android SDK could be Installed without Android studio, in this case your path might be different, and depends on your installation.
Add it to System Path
When you have determined ADB's location, add it to system, follow this syntax and type it in terminal:
(in macOS)
export PATH="your/path/to/adb/here":$PATH
for example: export PATH="~/Library/Android/sdk/platform-tools":$PATH
I don't know how did you install the android SDK. But in Mac OS, what really worked for me is to reinstall it using brew. All problems solved in a row.
brew cask install android-sdk
Later on:
android update sdk --no-ui --filter 'platform-tools'
Like a charm
For zsh
users. Add alias adb='/Users/<yourUserName>/Library/Android/sdk/platform-tools/adb'
to .zshrc
file.
Than run source ~/.zshrc
command
For me, I ran into this issue after switching over from bash to zsh so I could get my console to look all awesome fantastic-ish with Hyper and the snazzy theme. I was trying to run my react-native application using react-native run-android
and running into the op's issue. Adding the following into my ~.zshrc
file solved the issue for me:
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
Simply install adb with brew
brew cask install android-platform-tools
Check if adb is installed
adb devices
If you are using zsh
on an OS X, you have to edit the zshrc file.
Use vim or your favorite text editor to open zshrc file:
vim ~/.zshrc
Paste the path to adb
in this file:
export PATH="/Users/{$USER}/Library/Android/sdk/platform-tools":$PATH
Or the alternative solution could be
- Make sure you already install for android SDK. Usually it is located under /Users/your-user-name/Library/Android/sdk
If the SDK is there then run this command. ./platform-tools/adb install your-apk-location
From there you can generate the APK file That's the only sample to check if adb command is there
It's working fine..
brew install android-sdk
Later on:
android update sdk --no-ui --filter 'platform-tools'
'Programing' 카테고리의 다른 글
IP에서 방문자 국가를 가져 오기 (0) | 2020.05.08 |
---|---|
UIImage와 Base64 문자열 간 변환 (0) | 2020.05.08 |
앱이 설치되지 않은 것으로 보여도 [INSTALL_FAILED_UPDATE_INCOMPATIBLE] 실패 (0) | 2020.05.08 |
JQuery : 입력 필드의 변화 감지 (0) | 2020.05.08 |
Java에서 부울 변수를 전환하는 가장 확실한 방법은 무엇입니까? (0) | 2020.05.08 |