错误:(6,0)未找到Gradle DSL方法:"google()" [英] Error:(6, 0) Gradle DSL method not found: 'google()'

查看:211
本文介绍了错误:(6,0)未找到Gradle DSL方法:"google()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method.
Gradle settings
The build file may be missing a Gradle plugin.
Apply Gradle plugin

推荐答案

google()存储库是在Google Maven存储库中查找依赖项的快捷方式.它是随 gradle v引入的. 4.0 .

The google() repo is a shortcut to look in Google's Maven repository for dependencies. It was introduced with gradle v.4.0.

(当前)需要

  • 第v.4版
  • Android Studio 3.x.
  • Android 3.x的Gradle插件

尝试在gradle-wrapper.properties中使用:

distributionUrl=\
  https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip

作为适用于Android的gradle插件:

As gradle plugin for Android use:

classpath 'com.android.tools.build:gradle:3.0.0-beta1'

在任何情况下(同样在Android Studio 2.3,gradle插件2.3.3和gradle v3.3中),您都可以使用{ url 'https://maven.google.com'}使用相同的Maven存储库.一样.

In any case (also with Android Studio 2.3, gradle plugin 2.3.3 and gradle v3.3) you can use the same maven repo using { url 'https://maven.google.com'}. It is the same.

仅使用例如:

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
 //
}

这篇关于错误:(6,0)未找到Gradle DSL方法:"google()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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