React Native 使 android 应用程序在 genymotion 中加载 [英] React Native make android app load in genymotion

查看:42
本文介绍了React Native 使 android 应用程序在 genymotion 中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 React Native 中构建一个 android 应用程序.我遵循了官方指南并下载了 genymotion 并在 react native 中创建了一个新项目.如何在 genymotion 中打开我的项目?

I am trying to build an android app in react native. I have followed the official guidelines and downloaded genymotion and created a new project in react native. How do I open my project in genymotion?

我的终端出现以下错误

FAILURE:构建失败,出现异常.

FAILURE: Build failed with an exception.

  • 哪里:构建文件 '/Users/adamkatz/Projects/testAndroid/android/app/build.gradle' 行:69

  • Where: Build file '/Users/adamkatz/Projects/testAndroid/android/app/build.gradle' line: 69

出了什么问题:评估项目:app"时出现问题.

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

未找到 SDK 位置.使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置.

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

  • 试试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.

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

    构建失败

    总时间:6.504 秒无法在设备上安装该应用程序,请阅读上面的错误以了解详细信息.确保您有一个正在运行的 Android 模拟器或已连接的设备设置你的 Android 开发环境:https://facebook.github.io/react-native/docs/android-setup.html

    Total time: 6.504 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

    当我添加以下内容时export ANDROID_HOME=/usr/local/opt/android-sdk

    when i added the following export ANDROID_HOME=/usr/local/opt/android-sdk

    我收到以下错误信息

    FAILURE:构建失败,出现异常.

    FAILURE: Build failed with an exception.

    • 出了什么问题:配置项目:app"时出现问题.

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

    未能找到构建工具修订版 23.0.1

    failed to find Build Tools revision 23.0.1

  • 试试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.

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

    构建失败

    总时间:3.735 秒无法在设备上安装该应用程序,请阅读上面的错误以了解详细信息.确保您有一个正在运行的 Android 模拟器或已连接的设备设置你的 Android 开发环境:https://facebook.github.io/react-native/docs/android-setup.html

    Total time: 3.735 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

    推荐答案

    你必须定义 ANDROID_HOME 我从下面的 React Native 设置指南和下面的链接中复制了相关部分.

    You must define ANDROID_HOME I copied the relevant parts from the React Native setup guide below and link below that.

    在 Mac 上,将它添加到您的 ~/.bashrc、~/.bash_profile 或您的 shell 使用的任何内容:如果你通过 Homebrew 安装了 SDK,否则 ~/Library/Android/sdk

    On Mac, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses: If you installed the SDK via Homebrew, otherwise ~/Library/Android/sdk

    export ANDROID_HOME=/usr/local/opt/android-sdk
    

    在 Linux 上,将此添加到您的 ~/.bashrc、~/.bash_profile 或您的 shell 使用的任何内容中:

    On Linux, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses:

    export ANDROID_HOME=<path_where_you_unpacked_android_sdk>
    

    在 Windows 上,转到控制面板 -> 系统和安全 -> 系统 -> 更改设置 -> 高级 -> 环境变量 -> 新建

    On Windows, go to Control Panel -> System and Security -> System -> Change settings -> Advanced -> Environment variables -> New

    https://facebook.github.io/react-native/docs/android-setup.html#define-the-android-home-environment-variable

    这篇关于React Native 使 android 应用程序在 genymotion 中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆