React NativeのプロジェクトをAndroid Studioでビルドしようとしたらエラーになったので対処メモ。
Android Studio 3.1.3
react-native-cli 2.0.1
react 16.4.1
react-native 0.56.0
Failed to resolve: common
Project/build.gradleの記述を修正
修正前
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() maven { url 'https://maven.google.com/' name 'Google' } google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } maven { url 'https://maven.google.com/' name 'Google' } } } ext { buildToolsVersion = "26.0.3" minSdkVersion = 16 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = "26.1.0" }
修正後
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven { url 'https://maven.google.com/' name 'Google' } mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } } ext { buildToolsVersion = "26.0.3" minSdkVersion = 16 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = "26.1.0" }