您的位置:首页 > 移动开发 > Android开发

Android Studio Gradle 配置文件样例

2015-05-02 08:51 295 查看
项目主build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
mavenCentral()
}
dependencies {
// http://tools.android.com/tech-docs/new-build-system classpath 'com.android.tools.build:gradle:1.2.2'

// https://bitbucket.org/hvisser/android-apt classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
}


Android build.gradle

apply plugin: 'com.android.application'

//Android Annotations
apply plugin: 'com.neenbedankt.android-apt'

android {
//    signingConfigs {
//        release {
//            storeFile file("xxx")
//            storePassword "xx"
//            keyAlias "xx"
//            keyPassword "xx"
//        }
//    }

compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.xxx"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
//            signingConfig signingConfigs.release
minifyEnabled false //是否代码混淆
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//Gradle的.so文件,默认放在jniLibs下,如果不是这个目录,需要下面的配置指定
//    sourceSets {
//        main {
//            jniLibs.srcDirs = ['libs']
//        }
//    }
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'

//Android Annotations
// http://androidannotations.org/ // https://github.com/excilys/androidannotations/wiki // 30/04/2015 The 3.3 release is out !
apt "org.androidannotations:androidannotations:3.3"
compile 'org.androidannotations:androidannotations-api:3.3'

// https://github.com/spring-projects/spring-android 2.0.0.M1
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
// https://github.com/google/gson compile 'com.google.code.gson:gson:2.3.1'
// http://ormlite.com/ compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'

//    compile project(':otherModule')
}

apt {
arguments {
resourcePackageName android.defaultConfig.applicationId
androidManifestFile variant.outputs[0].processResources.manifestFile
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: