我正在尝试安装 react-native-camera
。
我做了 npm install react-native-camera
react-native link react-native-camera
。
它给我的错误是 Gradle sync failed: Could not find method google() for arguments [] on repository container
。
我也按照文档中的说明尝试了手动链接,直到我添加的第 6 步
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
我使用了 exifinterface
版本,例如27.+ 而不是 25.+
我有 distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
作为 distributionUrl 和 classpath 'com.android.tools。构建:gradle:2.2.3'
我不知道我错过了什么。当我打开我的 android 工作室时,它给我错误 Gradle sync failed: Could not find method google() for arguments [] on repository container
当我在我的手机上运行 react-native run-android
时,它给我一个错误提示:undefined is not an object (evaluating 'cameramanager.aspect')
谁能帮我看看我在这里错过了什么??
这是我的gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
最佳答案
您可以尝试将您的 gradle (android\build.gradle) 升级到这个版本
classpath 'com.android.tools.build:gradle:3.0.1'
为此,您还需要升级 android/gradle/wrapper/gradle-wrapper.properties
来自
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
到
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
这为我解决了类似的问题。
关于android - react native 相机 Gradle 同步失败 : Could not find method google() for arguments [] on repository container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50151803/