Recently I sorted out the previous Gradle knowledge points


// This is an Android application module. If it is a Library, call it Library'com.android. Library'.

applyplugin:'com.android.application'

android {

    compileSdkVersion 26// Compiled version, which version of SDK is used to compile

    buildToolsVersion "26.0.1"// Build tools

    // Configure more details of the project

    defaultConfig {

    applicationId"com.seachal.myapplicationtestlog"

    minSdkVersion 19

    targetSdkVersion 26

    versionCode1

    versionName "1.0"

    testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"

}

// Specify the configuration to generate the installation file

buildTypes {

      The release closure is used to specify the configuration to generate the official installation file

      release {

      minifyEnabledfalse// Specifies whether to obfuscate the project code, true for obfuscation and false for non-obfuscation.

      //proguard-android. TXT in the default SDK directory, there are general obliquation rules

      // Proguard-rules. pro has obfuscation rules for this project

      proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'

}

// Debug closures can be ignored}}dependencies {

        // A local dependency declaration that adds all.jar files from the libs directory to the project's build path

        compile fileTree(dir:'libs'.include: ['*.jar'])

        androidTestCompile('com. Android. Support. Test. Espresso: espresso - core: 2.2.2', {

        excludegroup:'com.android.support',module:'support-annotations'

        })

        // Remote dependency declaration

        compile'com.android.support:appcompat-v7:26.+'

        / / com. Android. Support. The constraint is the domain name. Constraint-layout is the group name that distinguishes different libraries within the same company. 1.0.2 is the version number

        compile'com. Android. Support. The constraint, the constraint - layout: 1.0.2'

        //compile project(':helper'); // Compile project(':helper'

        // Declare the test case library

        testCompile'junit: junit: 4.12'

}

Copy the code