Android Gradle工程目录

编译的gradle版本:

PROJECT\gradle\wrapper\gradle-wrapper.properties,此为2.10版本

#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

工作控件内的各个modules:

PROJECT\.idea\modules.xml

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/ConvenientBanner.iml" filepath="$PROJECT_DIR$/ConvenientBanner.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
      <module fileurl="file://$PROJECT_DIR$/convenientbanner/convenientbanner.iml" filepath="$PROJECT_DIR$/convenientbanner/convenientbanner.iml" />
    </modules>
  </component>
</project>

$PROJECT_DIR$/ConvenientBanner.iml为工程项目配置,$PROJECT_DIR$/app/app.iml为项目下的module配置,与各个*.iml文件对应。

Android各个module编译配置:

PROJECT\app\build.gradle:表示app这个module下Android工程配置

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.bigkoo.convenientbannerdemo"
        minSdkVersion 14
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/universal-image-loader-1.9.4.jar')
    compile 'com.android.support:recyclerview-v7:21.0.3'
    compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
    compile project(':convenientbanner')
}
  • compileSdkVersion:Android API版本
  • buildToolsVersion:Android编译工具版本
  • minSdkVersion:最小版本
  • dependencies:依赖的架包
    架包:
  • compile fileTree(dir: ‘libs’, include: [‘*.jar’]):表示项目中libs文件下所有jar包
  • compile files(‘libs/universal-image-loader-1.9.4.jar’):引用libs文件夹下的universal-image-loader-1.9.4.jar架包
  • compile project(‘:convenientbanner’):依赖convenientbanner module

Gradle编译版本

PROJECT\build.gradle文件中:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0' 
    }
}
allprojects { 
   repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
    原文作者:BlackNeko
    原文地址: https://www.jianshu.com/p/27ca334c1eb8
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞