错误:(30,0)找不到参数的方法compile() [英] Error:(30, 0) Could not find method compile() for arguments
问题描述
我收到此错误。我很困惑,因为我检查了sdk管理器中的所有内容并且它都已更新(我认为是这样)。
I get this error. I'm pretty confused because i check everything in sdk manager and it's all updated (i think so).
错误:(30,0 )无法在
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler类型的对象上找到参数
[com.android.support:appcompat-v7:+]的方法compile() 。
Error:(30, 0) Could not find method compile() for arguments [com.android.support:appcompat-v7:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
请从Android SDK
Manager安装Android Support Repository。打开Android SDK Manager
Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager
build.grandle中的代码是否有问题:
Is there something wrong with my code in build.grandle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
或缺少什么......?
or is something missing...?
推荐答案
你无法使用 compile()
顶级文件中的DSL 。
删除此项阻止:
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
并在依赖项中添加依赖项
在 app / build.gradle
文件中阻止。
这篇关于错误:(30,0)找不到参数的方法compile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!