관리 메뉴

나만을 위한 블로그

[React-Native] 안드로이드 빌드 시 SDK location not found 에러 해결 본문

React Native

[React-Native] 안드로이드 빌드 시 SDK location not found 에러 해결

참깨빵위에참깨빵_ 2025. 6. 6. 23:29
728x90
반응형

이 에러의 원문은 아래와 비슷한 형태일 것이다.

 

BUILD FAILED in 10s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\user\Desktop\develop\myproject\android\local.properties'. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 10s.
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 

아마 이 에러는 Expo가 아닌 리액트 네이티브 CLI로 프로젝트를 만들고 즉시 안드로이드 기기에서 빌드했을 때 가장 많이 발생하는 에러가 아닐까 싶다.

저 내용을 번역하면 아래와 같다.

 

SDK 위치가 발견되지 않았다. ANDROID_HOME 환경변수를 설정하거나 프로젝트의 로컬 종속 파일에서 sdk.dir 경로를 설정해 유효한 SDK 위치를 지정하라

 

다행히 해결법이 적혀 있다. ANDROID_HOME 환경변수를 설정하지 않았다면 설정하면 되고, 그게 아니라면 sdk.dir 경로를 설정하면 된다.

이미 안드로이드 스튜디오로 만든 프로젝트가 있다면 그 프로젝트의 local.properties에 있는 sdk.dir 부분을 복사한다.

 

그리고 리액트 네이티브 프로젝트의 android 폴더에 local.properties 폴더를 만든 다음 npm 또는 yarn 명령어로 안드로이드에 빌드하면 성공한다.

 

 

반응형
Comments