2017-11-23 15 views
26
[email protected]:~/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 
+0

अपने प्रश्न –

+0

आप के रूप में हल जवाब का चयन मन होता स्वरूपित कृपया? धन्यवाद। –

उत्तर

75

आमतौर पर आपके ग्रेडल फ़ाइलों में आपके रिपॉजिटरीज़ में समस्या होती है।

buildscript { 
    repositories { 
     mavenLocal() 
     google() 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1' 
    } 
} 

इसलिए जब आप गूगल को जोड़ने() यह काम करना चाहिए:

मेरे लिए

इस तरह build.gradle संशोधित करने के लिए काम किया।

+2

मान लें कि प्रतिक्रिया-देशी-क्ली कोड –

+1

में एक बग है जो Google() मेरे लिए भी काम करता है –

+0

पुष्टि करता है कि Google() काम करता है – Kiavor

15
buildscript { 
    repositories { 
     jcenter() 
     google() 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1'  
    } 
} 

buildscript() और सिंक परियोजना के अंदर google() जोड़ें।

संदर्भ: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#apply_plugin

+1

धन्यवाद मेरे दिन बचाने के लिए @ketan रमनी ... –