React-Native Android - 找不到 com.android.tools:common [英] React-Native Android - Could not find com.android.tools:common

查看:39
本文介绍了React-Native Android - 找不到 com.android.tools:common的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎以某种方式删除了 android/tools/common 库(pom, jar).

这导致许多在类路径中使用旧 gradle 版本的 React Native 库(例如 com.android.tools.build:gradle:2.2.3)无法同步>

我该如何解决?

解决方案

更新,我不得不向build.gradle

添加更多代码

这是我的修复,我没有 fork repos 只是使用了这个解决方法:将它添加到您的 build.gradle 文件中,settings.gradle 文件的兄弟>

buildscript {存储库{谷歌()jcenter { url "http://jcenter.bintray.com/"}maven { url "https://dl.bintray.com/android/android-tools" }}}子项目 { 项目 ->定义名称 = 项目名称if (name.contains('模块名称,例如 react-native-blur')||name.contains('其他模块名称,例如 react-native-image-picker')) {构建脚本{存储库{maven { url "https://dl.bintray.com/android/android-tools/" }}}}}

It seems that somehow the android/tools/common library has been deleted (pom, jar).

This caused many react native libraries that are using an old gradle version in their classpath (e.g com.android.tools.build:gradle:2.2.3) to not being able to sync

How can i fix it?

解决方案

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/"  }
        }
    }
  } 
}

这篇关于React-Native Android - 找不到 com.android.tools:common的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆