Apple@mosesdeMacBook-Pro:~/Desktop/sxtbdemo2$ react-native run-Android
Scanning folders for symlinks in /Users/Apple/Desktop/sxtbdemo2/node_modules (8ms)
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 'sxtbdemo2'.
Could not resolve all files 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:
project :
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 12s
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
C'est généralement un problème avec vos référentiels dans vos fichiers Gradle.
pour moi a travaillé pour modifier le build.gradle comme ceci:
buildscript {
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
classpath 'com.Android.tools.build:gradle:3.0.1'
}
}
ainsi, lorsque vous ajoutez google (), cela devrait fonctionner.
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.Android.tools.build:gradle:3.0.1'
}
}
Ajouter google()
à l'intérieur de buildscript()
et Sync Project.
Référence: https://developer.Android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin