确保你有一个Android模拟器运行或设备连接和拥有

我试图通过我的React Project运行react-native run-android 。 之后,我得到了如下错误。

  Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug... FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > Could not resolve all dependencies for configuration ':app:_debugCompile'. > Could not find com.android.support:appcompat-v7:23.0.1. Searched in the following locations: file:/C:/Users/DELL/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom file:/C:/Users/DELL/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar Required by: AwesomeProject:app:unspecified AwesomeProject:app:unspecified > com.facebook.react:react-native:0.27.2 > Could not find com.android.support:recyclerview-v7:23.0.1. Searched in the following locations: file:/C:/Users/DELL/.m2/repository/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.pom file:/C:/Users/DELL/.m2/repository/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.jar https://jcenter.bintray.com/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.pom https://jcenter.bintray.com/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.jar file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.pom file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/recyclerview-v7/23.0.1/recyclerview-v7-23.0.1.jar Required by: AwesomeProject:app:unspecified > com.facebook.react:react-native:0.27.2 > Could not find com.android.support:support-v4:23.1.1. Searched in the following locations: file:/C:/Users/DELL/.m2/repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom file:/C:/Users/DELL/.m2/repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar https://jcenter.bintray.com/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom https://jcenter.bintray.com/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom file:/F:/Android/react/AwesomeProject/node_modules/react-native/android/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar Required by: AwesomeProject:app:unspecified > com.facebook.react:react-native:0.27.2 > com.facebook.fresco:fresco:0.10.0 > com.facebook.fresco:drawee:0.10.0 AwesomeProject:app:unspecified > com.facebook.react:react-native:0.27.2 > com.facebook.fresco:fresco:0.10.0 > com.facebook.fresco:imagepipeline:0.10.0 AwesomeProject:app:unspecified > com.facebook.react:react-native:0.27.2 > com.facebook.fresco:fresco:0.10.0 > com.facebook.fresco:imagepipeline:0.10.0 > com.facebook.fresco:imagepipeline-base:0.10.0 * 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: 17.502 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 

我安装了Android SDK,并成功设置了Android Home和Path Environmental Variable。 但是我仍然得到相同的错误。

我还在我的电脑上安装了Gennymotion来创build虚拟的Android设备。

Solutions Collecting From Web of "确保你有一个Android模拟器运行或设备连接和拥有"

我刚才有这个问题 这是项目文件夹中的权限问题。 拥有:

 sudo chown -R nomeDoUsuario \AwesomeProject 

在这个React Native AwesomeProject教程中 ,作者指出项目的Android Studio构build版本可能需要在项目的build.gradle文件中更新。

如果您使用的是最新版本的Android Studio,那么如果您的教程稍微长一些,也可能需要这样做。

find应该位于\AwesomeProject\android\app\文件夹中的项目的build.gradle文件。

build.gradle文件中findbuildToolsVersion "23.0.1"并更改为buildToolsVersion "23.0.3"

请注意,文件中可能会有另外一个"23.0.1"string,但这是针对Android支持版本的,应该保持不变。

我刚刚撤销了权限,又重新接受了。 我知道这听起来很愚蠢,但我也尝试了其他的select,直到我看到cordova也没有认出我的装置。 我刚刚拔掉手机,从学校到我家。 我希望对于一些人来说,这可以很容易地解决。