在Android模拟器上安装应用程序时配置根项目时出错

时间:2018-04-04 06:55:20

标签: react-native-android

尝试在Android模拟器上运行react-native应用程序时,出现以下错误。请注意android模拟器已经运行。

A problem occurred configuring root project 'MyReactNativeApp'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.0.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.0.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/3.0.1/gradle-3.0.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/3.0.1/gradle-3.0.1.pom'.
               > jcenter.bintray.com

* 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 2s
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/getting-started.html

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

解决方案很简单。我所做的只是升级反应原生,它解决了问题。

$arr = array(2, 3, 1, 4, 5, 6, 1, 1,10,11,12,1);
$result = [];
foreach($arr as $key => $val){
    $result[$val][] = $key;
}

echo end($result[1]);// 11 but it should be 6