react-native run-android mac抱错SDK location not found.



  • FAILURE: Build failed with an exception.

    • Where:
      Build file '/Users/apple/Desktop/react/react2016_2_14demo/android/app/build.gradle' line: 102

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

    SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

    • Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 8.189 secs
    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
    我的sdk配置如下;
    sudo vi ~/.bashrc
    export ANDROID_HOME=~/Library/Android/sdk



  • 经过测试发现,Mac系统的bash默认并不会加载.bashrc文件,可以把配置写到.bash_profile文件中,或者在.bash_profile里添加如下代码:

    source ~/.bashrc
    


  • @jason_zds /Library/Android/sdk 这个目录下有哪些子目录?
    我在WINDOWS上遇到过类似问题,开始装的ANDROID SDK不好使,后来装的是ANDROID STUDIO就行了



  • 在MAC下 遇到同样的报错, 我echo $ANDROID_HOME 看了路径也是对的
    可就是报这个错 , 请问楼主解决了么??


登录后回复