内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
build.gradlefile
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.praval.healthfreak" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.google.android.gms:play-services:8.3.0' compile 'de.hdodenhof:circleimageview:1.3.0' compile 'com.android.support:design:23.2.1' compile files('libs/YouTubeAndroidPlayerApi.jar') }
更新最新的gradle解决这个问题的版本,使用最新的AndroidStudio3.0
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' } }
注:如果使用的是AndroidStudio2.3或更低版本,请使用
classpath 'com.android.tools.build:gradle:2.3.3'