簡體   English   中英

React Native for Android中的依賴性錯誤

[英]Dependency error in React Native for Android

我正在為Android編寫React Native App。 我用react-native-cli初始化了這個項目。 當我嘗試在Android上運行它時,我收到以下錯誤:

$ react-native run-android

Scanning folders for symlinks in /path/to/myreactnativeproject/node_modules (6ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

 FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'myreactnativeproject'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
     https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
     https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
     :myreactnativeproject:unspecified

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

我使用的是Ubuntu 16.04,我安裝了Android Studio 3.0.1。 錯誤的原因是什么?

編輯:當我使用stacktrace,info和debug運行它時,我得到以下輸出:

我不能在這里發布輸出,因為它是long: pastebin

我通過將其添加到.bashrc來修復它:

export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH=$JAVA_HOME/bin:$PATH

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM