开发者社区> 问答> 正文

为什么构建适用于ios但不适用于android?反应本机

我刚刚创建了一个带有react native的新项目,下载了自制软件,Android Studio和Watchman,但仍无法在虚拟设备上构建我的项目。从创建项目开始,它就可以在IOS上运行,但不能在Android上运行。


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/cal/Solvicles/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 2s

error Failed to install the app. Make sure you have the Android development environment set up

展开
收起
Puppet 2020-01-06 14:56:06 607 0
1 条回答
写回答
取消 提交回答
  • 根据文档:

    您是否尝试过将ANDROID_HOME环境变量添加到$HOME/.bash_profile?如果没有,请继续将其添加到您.bash_profile的主~目录中(如果文件不存在,则创建)。

    export ANDROID_HOME=$HOME/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/emulator
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH:$ANDROID_HOME/platform-tools
    

    然后重新启动终端,然后尝试再次运行它。

    2020-01-06 14:56:24
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
手淘iOS性能优化探索 立即下载
From Java/Android to Swift iOS 立即下载
深入剖析iOS性能优化 立即下载