react-native run-android 失败,无法安装应用 [英] react-native run-android fails, could not install app

查看:127
本文介绍了react-native run-android 失败,无法安装应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在我的 Android 设备中运行我的 react-native 应用程序时遇到问题.即使我确定设备已连接,该设备也已连接.

<块引用>

adb 设备

连接的设备列表

HMNBBCE6A2826109 设备

设备:华为Y2安卓版本:5.1调试模式:enbaled服务器正在运行.当我跑

<块引用>

react-native run-android

我收到此错误

<块引用>

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

解决方案

我的 linux 笔记本电脑遇到了同样的问题.我在我的应用程序根文件夹中运行它并工作:

chmod 755 android/gradlew

您必须对 android/gradlew 授予许可.

我在 this github issue

上找到了答案

而且你也必须这样做:

点击这里查看关于 react 的所有文章-本机文档页面(我获取此信息的地方).

<块引用>

  1. 配置 ANDROID_HOME 环境变量
    React Native 工具需要设置一些环境变量才能使用本机代码构建应用程序.
    将以下行添加到您的 $HOME/.bash_profile 配置文件中:
    导出 ANDROID_HOME=$HOME/Android/Sdk
    导出路径=$PATH:$ANDROID_HOME/tools
    导出路径=$PATH:$ANDROID_HOME/platform-tools

    .bash_profile 特定于 bash.如果您使用其他 shell,则需要编辑相应的特定于 shell 的配置文件.

I m having a problem when I try to run my react-native application in my Android Device. The device is connected even when I make sure that it is.

adb devices

List of devices attached

HMNBBCE6A2826109 device

Device: Huawei Y2 Android Version: 5.1 Debug mode: enbaled the server is running. When i run

react-native run-android

I get this error

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

解决方案

I had the same problem with my linux laptop. I ran this inside my app root folder and worked:

chmod 755 android/gradlew

You have to give permission on the android/gradlew.

I found the answer on this github issue

And you must also do this:

Click here to see the all article on the react-native docs page (the place where i get this information).

  1. Configure the ANDROID_HOME environment variable
    The React Native tools require some environment variables to be set up in order to build apps with native code.
    Add the following lines to your $HOME/.bash_profile config file:
    export ANDROID_HOME=$HOME/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/platform-tools

    .bash_profile is specific to bash. If you're using another shell, you will need to edit the appropriate shell-specific config file.

这篇关于react-native run-android 失败,无法安装应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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