【发布时间】:2018-02-08 10:32:29
【问题描述】:
我遵循 react native android 指南页面中的所有说明,但是当我使用 react-cli 创建项目并运行 react-native run-android 时,我遇到了一些错误:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'test'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve org.apache.commons:commons-compress:1.8.1. Required by: :test:unspecified > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 >com.android.tools:sdklib:25.2.3 :test:unspecified > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:repository:25.2.3
无法解析 org.apache.commons:commons-compress:1.8.1。 无法获取资源“https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom”。 无法 HEAD 'https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom'。 连接到 jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] 失败:连接超时 (连接超时)
* 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: 2 mins 16.65 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
我在谷歌上搜索了一整天以找出导致此问题的原因,但没有发现任何有用的信息。 这是一些信息:
$ java -version
openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3b11) OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)$ android list avd
Available Android Virtual Devices: Name: Pixel_API_25 Device: pixel (Google) Path: /home/danial/.android/avd/Pixel_API_25.avd Target: Google APIs (Google Inc.) Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86_64 Skin: pixel Sdcard: 100M$ 回声 $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/danial/Android/Sdk/tools:/home/danial/Android/Sdk/platform-tools:/home/danial/Android/Sdk/tools/bin
所以所有东西都设置正确我真的不知道问题出在哪里。
**First Answer Error Again:** [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. [Fatal Error] apache-13.pom:1:44: Content is not allowed in prolog. FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'test'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve org.apache.commons:commons-compress:1.8.1. Required by: :test:unspecified > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 >com.android.tools:sdklib:25.2.3 :test:unspecified > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:repository:25.2.3
无法解析 org.apache.commons:commons-compress:1.8.1。 无法解析 POM https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom 无法解析 org.apache.commons:commons-parent:33。 无法解析 org.apache.commons:commons-parent:33。 无法解析 POM https://jcenter.bintray.com/org/apache/commons/commons-parent/33/commons-parent-33.pom 无法解析 org.apache:apache:13。 无法解析 org.apache:apache:13。 无法解析 POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache:apache:13。 无法解析 POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache.commons:commons-parent:33。 无法解析 POM https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom 无法解析 org.apache:apache:13。 无法解析 org.apache:apache:13。 无法解析 POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache:apache:13。 无法解析 POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache.commons:commons-compress:1.8.1。 无法解析 POM https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom 无法解析 org.apache.commons:commons-parent:33。 无法解析 org.apache.commons:commons-parent:33。 无法解析 POM https://jcenter.bintray.com/org/apache/commons/commons-parent/33/commons-parent-33.pom 无法解析 org.apache:apache:13。 无法解析 org.apache:apache:13。 无法解析 POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache:apache:13。 无法解析 POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache.commons:commons-parent:33。 无法解析 POM https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom 无法解析 org.apache:apache:13。 无法解析 org.apache:apache:13。 无法解析 POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom 序言中不能有内容。 无法解析 org.apache:apache:13。 无法解析 POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom 序言中不允许有内容。
【问题讨论】:
-
你使用什么操作系统?
-
@wlisrausr Ubuntu 16.04 LTS
-
是的,但没有任何改变,我仍然有错误:(
-
我在运行项目时使用 android studio 测试我的纯 android 项目问题,它将在模拟器上安装应用程序并完美运行,但是我阅读了关于从命令行运行 android 项目的developer.android.com/studio/build/… 页面但是当我在命令行上运行 gradlew installDebug 我遇到了同样的错误,所以真正的问题是 android studio 如何构建项目并在模拟器上运行它,而我不能用命令行来做?
标签: android gradle react-native android-gradle-plugin gradlew