错误消息:
无法获得类型对象的未知属性'supportVersion' org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。
Build.gradle代码:-
apply plugin:'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.eassycars.www.dlservices"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// google & support
implementation "com.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler :$supportVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
// utils
implementation 'com.github.bumptech.glide:glide:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
implementation 'com.koushikdutta.ion:ion:2.1.7'
implementation 'com.github.Commit451:bypasses:1.0.4'
implementation 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
implementation 'com.drewnoakes:metadata-extractor:2.9.1'
implementation "com.orhanobut:hawk:2.0.1"
classpath 'com.google.gms:google-services:3.1.1'
compile 'com.android.support:support-annotations:27.1.1'
}
任何人都可以告诉我如何解决此错误
答案 0 :(得分:2)
该错误表明变量$ supportVersion没有任何值。如果您确切知道要使用的版本,请像定义supportVersion
一样定义buildToolsVersion
。我不确定,但对于您的情况相同。
buildToolsVersion '27.0.3'
supportVersion '27.0.3'
或在现有文件中将supportVersion
替换为buildToolsVersion
。
答案 1 :(得分:1)
您需要在Gradle的android{}
上方添加
ext {
supportVersion='27.1.1'
}