반응형
Android Build Error (failed to find Environment)
> cordova build android
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Failed to find 'ANDROID_SDK_ROOT' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
환경 변수 ANDROID_SDK_ROOT
, PATH
가 설정되어 있지 않아 발생하는 문제
ANDROID_SDK_ROOT 설정
Android SDK 설치
- Android Studio 설치
- 관리자 권한으로 실행 시 SDK 설치 창 출력 -> 설치
환경변수 설정
아래 변수에 대해 작업 시 완료
- ANDROID_SDK_ROOT (SDK 설치 위치)
- JAVA_HOME (JDK 설치 위치)
- PATH (기존 경로에 SDK/JDK 관련 폴더 추가)
- %JAVA_HOME%\bin;
- %ANDROID_HOME%\tools;
- %ANDROID_HOME%\platform-tools
> set ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
> set JAVA_HOME=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25
> set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin;
참고 : Android 환경변수 설정
JDK Version Error
> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Requirements check failed for JDK 1.8.x! Detected version: 11.0.10
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
1.8.x 버전과 다른 버전이 설치되어 있어 발생
JAVA_HOME 환경변수를 1.8.x 버전이 설치된 폴더로 적용시키면 해결
set %JAVA_HOME%=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25
ANDROID_SDK_ROOT Path Error
> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
'ANDROID_SDK_ROOT' environment variable is set to non-existent path: C:\Program Files (x86)\Android\android-sdk
Try update it manually to point to valid SDK directory.
확인 필요
Android Studio Error
> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: C:\Users\Administrator\AppData\Local\Android\sdk
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
Android Studio 프로젝트 생성 시 Gradle 자동 설치.
자동 설치 이후 환경변수 Path에 Gradle Bin 폴더 지정
# Gradle Path
# C:\Users\사용자명\.gradle\wrapper\dists\gradle-[version]-bin\[랜덤문자열]\gradle-[version]\bin
set PATH=%PATH%;C:\Users\WDAGUtilityAccount\.gradle\wrapper\dists\gradle-6.7.1-bin\bwlcbys1h7rz3272sye1xwiv6\gradle-6.7.1\bin
JDK 환경변수 오류
> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Your JAVA_HOME is invalid: C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25
PATH -> JDK\bin 경로가 잘 설정되어 있는지 확인 필요
>echo %PATH%
... ;C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25 \bin;
# 경로 상 공백이 있음. 공백 제거.
반응형
'Develop > Cordova' 카테고리의 다른 글
[Cordova, Exception] Build-tool 31.0.0 is missing DX (0) | 2021.07.20 |
---|---|
[Cordova] 1. 초기 환경 구축 (0) | 2021.07.20 |