Android开发之如何使AS问题降到最低

来源:互联网 发布:普华永道 55亿 知乎 编辑:程序博客网 时间:2024/06/18 02:16

版本问题

buildToolsVersion 'AA.E.F'compileSdkVersion AA  targetSdkVersion BBcompile 'com.android.support:appcompat-v7:CC.+'compile 'com.android.support:design:DD.+'

CC,DD,AA版本必须不高于BB
CC,DD必须一样

AS版本

2.1.2

JDK版本

选择1.7(勿选1.8问题太多)

app:build.gradle模板

apply plugin: 'com.android.application'android {    compileSdkVersion 21    buildToolsVersion '21.1.2'    defaultConfig {        applicationId "com.example.administrator.myapplication"        minSdkVersion 15        targetSdkVersion 21        versionCode 1        versionName "1.0"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }    productFlavors {    }}dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    compile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:21.0.0'}

project:build.gradle模板

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:2.1.2'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        jcenter()    }}task clean(type: Delete) {    delete rootProject.buildDir}

gradle

#Mon Dec 28 10:00:20 PST 2015distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

当jdk为1.8时的配置

apply plugin: 'com.android.application'android {    compileSdkVersion 23    buildToolsVersion "23.0.1"    defaultConfig {        applicationId "com.example.administrator.myapplication"        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.0.1'}
// Top-level build file where you can add configuration options common to all sub-projects/modules.        buildscript {            repositories {                jcenter()            }            dependencies {                classpath 'com.android.tools.build:gradle:2.1.2'                // NOTE: Do not place your application dependencies here; they belong                // in the individual module build.gradle files            }        }allprojects {    repositories {        jcenter()    }}task clean(type: Delete) {    delete rootProject.buildDir}
#Mon Dec 28 10:00:20 PST 2015distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
阅读全文
0 0