本文介紹了錯(cuò)誤:(6, 0) 未找到 Gradle DSL 方法:“google()"的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
/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()
存儲(chǔ)庫(kù)是在 Google 的 Maven 存儲(chǔ)庫(kù)中查找依賴項(xiàng)的快捷方式.它是通過(guò) 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.
它需要(當(dāng)前)
- Gradle 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 plugin 2.3.3 和 gradle v3.3),您可以使用 { url 'https://maven.google.com'}代碼>.是一樣的.
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' }
}
//
}
這篇關(guān)于錯(cuò)誤:(6, 0) 未找到 Gradle DSL 方法:“google()"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!