无法在设备上安装应用程序,请阅读上面的错误以获取详细信息

时间:2017-05-27 17:21:06

标签: react-native

我正在开发一个本机应用程序。我每天都在努力,但是今天,我发布了命令“react-native run-android”,我收到了这条消息:

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-billing'.
   > Could not resolve all dependencies for configuration ':react-native-billing:_debugCompile'.
      > Could not find com.android.support:appcompat-v7:25.3.1.
        Searched in the following locations:
            file:/C:/Users/xrobot/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            file:/C:/Users/xrobot/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
            https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
        Required by:
            AwesomeProject:react-native-billing:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1
      > Could not find com.android.support:recyclerview-v7:25.3.1.
        Searched in the following locations:
            file:/C:/Users/xrobot/.m2/repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.pom
            file:/C:/Users/xrobot/.m2/repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.jar
            https://jcenter.bintray.com/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.pom
            https://jcenter.bintray.com/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.jar
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.pom
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7/25.3.1/recyclerview-v7-25.3.1.jar
        Required by:
            AwesomeProject:react-native-billing:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1
      > Could not find com.atlassian.mobile.video:okhttp-ws-compat:3.7.0-atlassian1.
        Searched in the following locations:
            file:/C:/Users/xrobot/.m2/repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom
            file:/C:/Users/xrobot/.m2/repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.jar
            https://jcenter.bintray.com/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom
            https://jcenter.bintray.com/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.jar
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom
            file:/C:/Users/xrobot/Desktop/React Native/AwesomeProject/node_modules/react-native/android/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/android/m2repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.jar
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.pom
            file:/C:/Users/xrobot/AppData/Local/Android/sdk/extras/google/m2repository/com/atlassian/mobile/video/okhttp-ws-compat/3.7.0-atlassian1/okhttp-ws-compat-3.7.0-atlassian1.jar
        Required by:
            AwesomeProject:react-native-billing:unspecified > com.facebook.react:react-native:0.42.3-atlassian-1

* 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: 35.786 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

为什么?

3 个答案:

答案 0 :(得分:0)

尝试:

  1. adb devices =>设备列表: emulator-5554

  2. react-native run-android --deviceId emulator-5554

答案 1 :(得分:0)

除了@ user7425896

  1. adb设备=>设备列表:eb9c9bbc

  2. 从项目中删除Android和iOS文件夹

  3. 运行“反应本机弹出”,这将重新添加平台

  4. react-native run-android --deviceId eb9c9bbc

在Windows上测试

注意:在某些情况下,您可能必须执行以下操作:

  1. 清晰的守望者手表:watchman watch-del-all

  2. 删除node_modules文件夹:rm -rf node_modules && npm install

  3. 重置Metro Bundler缓存:rm -rf /tmp/metro-bundler-cache-*npm start -- --reset-cache

  4. 删除急速缓存:rm -rf /tmp/haste-map-react-native-packager-*

答案 2 :(得分:-1)

你正在运行代理或防火墙吗?如果是这样尝试将代理配置添加到.gradle文件中......基本上这意味着gradle无法为您的projectt找到所需的lib来正确构建