【问题标题】:React-Native Android - Could not find com.android.tools:commonReact-Native Android - 找不到 com.android.tools:common
【发布时间】:2019-05-10 12:20:39
【问题描述】:

似乎不知何故 android/tools/common 库已被删除 (pomjar)。

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

我该如何解决?

【问题讨论】:

    标签: android android-studio react-native android-gradle-plugin jcenter


    【解决方案1】:

    更新,我不得不向 build.gradle

    添加更多代码

    这是我的修复,我没有 fork 存储库,只是使用了这个解决方法:将它添加到您的 build.gradle 文件中,settings.gradle 文件的同级文件 p>

    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-image-picker 和 react-native-vector-icons 一起使用
    【解决方案2】:

    在我的 build.gradle 文件(项目而不是应用程序)中,我首先添加了新的 bintray url,但之后还必须添加所有其他的:

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

    【讨论】:

      猜你喜欢
      • 2019-05-09
      • 2022-08-02
      • 1970-01-01
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-14
      • 1970-01-01
      相关资源
      最近更新 更多