【问题标题】:React Native android build fails without an exceptionReact Native android构建失败无异常
【发布时间】:2016-08-15 05:36:54
【问题描述】:

我正在尝试在 Android 上运行一个非常简单的 React Native 应用程序,但构建一直失败。构建没有给出任何错误,run-ios 工作正常。

$ react-native run-android JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug... 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

我在 OSX 上运行并尝试在三星 Galaxy S6 上部署该应用程序,该应用程序位于 adb devices 列表中。还尝试将 ANDROID_HOME 变量设置为我的 .bash_profile 并更新构建工具,但这些都没有帮助。

如果有人能帮我解决这个问题,我会很高兴。

【问题讨论】:

    标签: android android-gradle-plugin react-native


    【解决方案1】:

    将 gradle 版本更改为 1.2.3。

    File android/build.gradle
    modify this line: classpath 'com.android.tools.build:gradle:1.2.3'
    

    【讨论】:

    • 试图这样做,但对这种情况没有帮助。仍然有同样的问题。
    • 你能用'adb shell'在设备上得到一个shell吗?手机是否开启了usb调试功能?
    • 'adb shell' 工作正常,并且启用了 USB 调试,并且在设备上授权了 mac。而且我实际上能够在手机上运行原生 android 项目和 Cordova 项目。所以 React Native 是我唯一遇到问题的框架。
    猜你喜欢
    • 2018-12-01
    • 2023-03-12
    • 1970-01-01
    • 2018-03-08
    • 2019-03-21
    • 1970-01-01
    • 1970-01-01
    • 2020-11-07
    • 1970-01-01
    相关资源
    最近更新 更多