Grade 常用语法和结构(待整理)

来源:互联网 发布:暗黑2 mac 编辑:程序博客网 时间:2024/06/16 13:46

1

apply plugin: 'com.android.application'dependencies {    compile project(':jus2')}android {    compileSdkVersion 23    buildToolsVersion "23.0.1"    useLibrary 'org.apache.http.legacy'    defaultConfig {        renderscriptTargetApi 23        renderscriptSupportModeEnabled true    }    sourceSets {        main {            manifest.srcFile 'AndroidManifest.xml'            java.srcDirs = ['src']            resources.srcDirs = ['src']            aidl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']        }        // Move the tests to tests/java, tests/res, etc...        instrumentTest.setRoot('tests')        // Move the build types to build-types/<type>        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...        // This moves them out of them default location under src/<type>/... which would        // conflict with src/ being used by the main source set.        // Adding new build types or product flavors should be accompanied        // by a similar customization.        debug.setRoot('build-types/debug')        release.setRoot('build-types/release')    }    productFlavors {        amazon {}        googleplay {}        justalk {}        oppo {}        xiaomi {}        productFlavors.all { flavor ->            flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]        }    }    buildTypes {        release {            minifyEnabled true            proguardFiles getDefaultProguardFile('proguard-android.txt'),                    'proguard-rules.txt'        }    }}

2

apply plugin: 'com.android.library'dependencies {    compile fileTree(include: '*.jar', dir: 'libs')    compile project(':preferencefragment')    compile 'com.android.support:appcompat-v7:23.1.0'    compile 'com.android.support:cardview-v7:23.1.0'    compile 'com.android.support:design:23.1.0'    compile 'com.android.support:recyclerview-v7:23.1.0'    compile 'com.facebook.android:facebook-android-sdk:4.5.0'    compile 'com.googlecode.libphonenumber:libphonenumber:7.0.11'    compile 'org.apmem.tools:layouts:1.10'    compile 'de.hdodenhof:circleimageview:2.0.0'    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'    compile 'com.squareup.picasso:picasso:2.5.2'    compile 'com.nineoldandroids:library:2.4.0'    compile 'com.edmodo:cropper:1.0.1'}android {    compileSdkVersion 23    buildToolsVersion "23.0.1"    defaultConfig {        renderscriptTargetApi 23        renderscriptSupportModeEnabled true    }    sourceSets {        main {            manifest.srcFile 'AndroidManifest.xml'            java.srcDirs = ['src']            resources.srcDirs = ['src']            aidl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']            jniLibs.srcDirs = ['libs']        }        // Move the tests to tests/java, tests/res, etc...        instrumentTest.setRoot('tests')        // Move the build types to build-types/<type>        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...        // This moves them out of them default location under src/<type>/... which would        // conflict with src/ being used by the main source set.        // Adding new build types or product flavors should be accompanied        // by a similar customization.        debug.setRoot('build-types/debug')        release.setRoot('build-types/release')    }}

3

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositories {        mavenCentral()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.3.1'    }}allprojects {    repositories {        mavenCentral()    }}
0 0