美文网首页react-native
react native android 踩坑记

react native android 踩坑记

作者: 花儿的爸爸 | 来源:发表于2016-12-09 10:13 被阅读40次

    运行环境

    操作系统:macOS Sierra 10.12.1
    jdk版本:1.8.0_101

    项目运行报错(react-native run-android)

    根据网上教程,安装了安卓运行环境,初始化项目执行react-native run-android

    本以为一切会顺利,结果报如下错误

    Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
    java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
    .
    .
    .
    .
    .
    * 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: 18.729 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
    
    anderror1.jpeg anderror2.jpeg

    ��但是经过仔细对照�官网和网上资料,发现我的环境并没有问题,后来在 stackoverflow 上找到了 答案

    具体做法是:在项目中 andorid�文件夹下新建一个名为local.properties 的文件
    内容写:

    sdk.dir=�你的sdk的路径
    

    保存后重新运行项目就ok了。

    相关文章

      网友评论

        本文标题:react native android 踩坑记

        本文链接:https://www.haomeiwen.com/subject/edjemttx.html