完整错误:
Gradle sync failed: Could not find method Dependencies() for arguments [build_aewao5k4tyewg69imdynjiuxi$_run_closure1$_closure3@7c332105] on object of type org.gradle.api.internal.initialization.DefaultScriptHandler.
顶级build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
Dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
答案 0 :(得分:3)
使用dependencies
(小d)代替Dependencies
答案 1 :(得分:0)
这适用于API 27已完全安装
确保你的gradle就像下一个
的build.gradle(项目)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
的build.gradle(Moudle) 在这个gradle中只需将yourPackageName更改为你的
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "yourPackageName"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
答案 2 :(得分:0)
将依赖项更改为依赖项
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}