Respond to Android's own launch

I follow all the instructions to respond to my own Android manual page, however, when I create a project with react-cli and run react-native run-android , I get some errors:

 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

Failed to resolve org.apache.commons: commons-compress: 1.8.1. Failed to get the resource https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom '. HEAD failed ' https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom '. Connect to jcenter.bintray.com-00-0043 [jcenter.bintray.com/75.126.118.188] failed: connection timeout (Connection timeout)

 * 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.imtqy.com/react-native/docs/android-setup.html 

I am looking for a full day to find out what causes this problem in google, but nothing was found. Here is some info:

$ 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 

$ echo $ 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

So everything is set up correctly, I really don't know where the problem is.

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

Failed to resolve org.apache.commons: commons-compress: 1.8.1. Failed to parse POM https://jcenter.bintray.com/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom Failed to resolve org.apache.commons: commons-parent: 33. Failed to resolve org.apache.commons: commons-parent: 33. Failed to parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/33/commons-parent-33.pom Failed to resolve org.apache: apache: 13. Failed to resolve org.apache: apache: 13. Failed to parse POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom Contents not available in the prologue. Failed to resolve org.apache: apache: 13. Failed to parse POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom Content is not available in the prolog. Failed to resolve org.apache.commons: commons-parent: 33. Failed to parse POM https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom Failed to resolve org.apache: apache: 13. Failed to resolve org.apache: apache: 13. Failed to parse POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom Contents not available in the prologue. Failed to resolve org.apache: apache: 13. Failed to parse POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom Content is not available in the prolog. Failed to resolve org.apache.commons: commons-compress: 1.8.1. Failed to parse POM https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom Failed to resolve org.apache.commons: commons- parent: 33. Failed to resolve org.apache.commons: commons-parent: 33. Failed to parse POM https://jcenter.bintray.com/org/apache/commons/commons-parent/33/commons-parent-33 .pom Unable to resolve org.apache: apache: 13. Unable to resolve org.apache: apache: 13. Unable to parse POM https://jcenter.bintray.com/org/apache/apache/13/apache-13. pom Content is not available in the prologue. Failed to resolve org.apache: apache: 13. Failed to parse POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom Content is not available in the prolog. Failed to resolve org.apache.commons: commons-parent: 33. Failed to parse POM https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom Failed to resolve org.apache: apache: 13. Failed to resolve org.apache: apache: 13. Failed to parse POM https://jcenter.bintray.com/org/apache/apache/13/apache-13.pom Contents not available in the prologue. Could not resolve org.apache: apache: 13. Could not parse POM https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom Content is not allowed in the prolog.

+5
source share
2 answers

It looks like your project was not able to get jcenter dependencies. Try adding repositories to your build.gradle file.

 repositories { mavenCentral() maven { url 'https://maven.fabric.io/public' } jcenter() } 

Put the code above into the body of buildscript {...} .

+1
source

Try running the command from the root directory. Create a resource folder in

  /android/app/src/main/ cd android ./gradlew clean react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ react-native run-android 
+1
source

Source: https://habr.com/ru/post/1271370/


All Articles