React-native 프로젝트를 새로 생성하고 난 후,
npx react-native run-android
를 했을 때, 많은 에러와 함께 실행되지 않았다.
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds
.
일단 가장 먼저 에뮬레이터 문제인 것 같아, 안드로이드 스튜디오에서 api에 맞는 sdk를 다운받아 실행시켜주었다.
이후 다시 실행해보았는데, 위의 에러는 없어졌지만, 해결안됨..
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
안드로이드 SDK 경로를 찾을 수 없다고 한다.
[https://stackoverflow.com/questions/64968851/could-not-find-tools-jar-please-check-that-library-internet-plug-ins-javaapple]
/usr/libexec/java_home -V | grep jdk
/Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home
export JAVA_HOME=위에서 찾은 경로
export PATH=$JAVA_HOME/bin:$PATH
다시 실행해본 결과 위의 에러가 해결되었다.