【问题标题】:Could not find method google() error in victory charts in React Native在 React Native 的胜利图中找不到方法 google() 错误
【发布时间】:2018-01-28 13:55:25
【问题描述】:

我对 React Native 和胜利原生图表完全陌生。我想为我的项目添加胜利原生图表。所以我按照这里的所有步骤 https://github.com/FormidableLabs/victory-native/blob/master/README.md

我在构建项目时遇到此错误

Could not find method google() for arguments [] on repository

请不要将此标记为重复,因为我已经尝试了上述问题的所有解决方案。我也试过了

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

    }
}

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"
        }
        google()
    }
}

但我仍然收到错误消息。请帮我解决这个问题。

【问题讨论】:

  • 你试过react-native link 吗?
  • 是的。什么都没发生
  • 请问您为什么使用google() ?我用的是victory-charts,没有google()
  • 当我构建项目时,我遇到了这个错误。之后,我为此寻找了解决方案。这就是我在那里添加 google() 的原因。请再次阅读问题:)

标签: android react-native victory-charts


【解决方案1】:

你必须将 Gradle 升级到 4.x 版(看起来像 also Android Studio etc.),因为你的版本不支持这种语法。

如果您不想升级,请使用

maven {
    url 'https://maven.google.com'
}

google() 快捷方式的作用相同。

(如果仍然无法使用,请发布您使用的 Gradle 和 Android Studio 版本。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-11
    • 2016-10-27
    • 1970-01-01
    • 1970-01-01
    • 2023-02-13
    • 2019-06-01
    相关资源
    最近更新 更多