 
                        buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}
apply plugin: 'com.android.application'
repositories {
    jcenter()
}
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.examplee.myapplication2.app"
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:7.0.0'
}
如上代码,我的是安卓5.1,但是每次新建项目,最后的
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:7.0.0'}
总是v7:23.1.1, 于是乎出错了。只有每次都要自己改成v7:22.+才正常。如果让这里默认就是v7:22.+呢?我是没有下载6.0的sdk啊!!


每次都要手动改成
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
是这样的,buildToolsVersion "22.0.1"版本和compile 'com.android.support:appcompat-v7:23.1.1'是匹配的,意思即为你的buildToolsVersion版本为22,就应该设置support:appcompat包围v7:22,所以建议你将buildToolsVersion版本设置为23
改成
当然,你的SDK里要确保Android SDK Build-tools已经installed这个版本了。
解决办法,是为了搭配最新的23.1.1,我下载了6.0的Api的一个包

然后最后的build.gradle是这样的: