React-Native Android - Could not find com.android.tools:common

橙三吉。 提交于 2019-11-30 11:18:25

Update, I had to add more code to build.gradle

This is my fix, I did not fork repos just used this workaround: add this to your build.gradle file, the sibling of settings.gradle file

buildscript {
  repositories {
     google()
     jcenter { url "http://jcenter.bintray.com/"}
     maven { url "https://dl.bintray.com/android/android-tools" }
  }
}

subprojects { project ->
  def name = project.name
  if (name.contains('module name, e.g. react-native-blur')
        || name.contains('other module name, e.g. react-native-image-picker')) {
    buildscript {
        repositories {
            maven { url "https://dl.bintray.com/android/android-tools/"  }
        }
    }
  } 
}

In my build.gradle file (of the project not the app) i've added the new bintray url first but also had to add all the others after:

subprojects {
    buildscript {
        repositories {
            maven { url 'https://dl.bintray.com/android/android-tools' }
            google()
            mavenLocal()
            jcenter()
        }
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!