react-native run-android

123456:rndemo2 ule_zhangfanglin$ react-native run-android
Scanning 556 folders for symlinks in /Users/admin/Desktop/RN学习/08/rndemo2/node_modules (7ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

ERROR: JAVA_HOME is set to an invalid directory: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
123456:rndemo2 ule_zhangfanglin$ cat ~/.profile

Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

export PATH="$PATH:$HOME/.rvm/bin"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function
123456:rndemo2 ule_zhangfanglin$ JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
123456:rndemo2 ule_zhangfanglin$ export JAVA_HOME
123456:rndemo2 ule_zhangfanglin$ react-native run-android

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
==========>
123456:rndemo2 ule_zhangfanglin$ touch .bash_profile
123456:rndemo2 ule_zhangfanglin$ open .bash_profile
123456:rndemo2 ule_zhangfanglin$ source .bash_profile
123456:rndemo2 ule_zhangfanglin$ react-native run-android

======>
export ANDROID_HOME=/Users/admin/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

======>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容