gradle大体内容
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
// 方法超过65535 做法 还有。。。
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
// optional
// dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
}
}
android {
compileSdkVersion 8
buildToolsVersion "22.0.1"
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')
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
//签名
signingConfigs {
//你自己的keystore信息
releaseConfig {
storeFile file("wf.keystore")
storePassword "123456"
keyAlias "wfwf"
keyPassword "654321"
}
debugConfig {
storeFile file("wf.keystore")
storePassword "123456"
keyAlias "wfwf"
keyPassword "654321"
}
}
buildTypes {
release{
minifyEnabled true
signingConfig signingConfigs.releaseConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
debug{
minifyEnabled false
signingConfig signingConfigs.debugConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
}
// This is important, it will run lint checks but won't abort build
lintOptions {
abortOnError false
}
dexOptions {
incremental true
}
}
不分包
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
//compile 'com.google.android:multidex:0.1'
}
android {
compileSdkVersion 8
buildToolsVersion "22.0.1"
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')
}
// //签名
// signingConfigs {
// //你自己的keystore信息
// releaseConfig {
// storeFile file("wf.keystore")
// storePassword "123456"
// keyAlias "wfwf"
// keyPassword "654321"
// }
// debugConfig {
// storeFile file("wf.keystore")
// storePassword "123456"
// keyAlias "wfwf"
// keyPassword "654321"
// }
// }
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
// buildTypes {
// release {
// minifyEnabled false
// signingConfig signingConfigs.releaseConfig
// proguardFile 'proguard.cfg'
// zipAlignEnabled true
// renderscriptOptimLevel 5
//
// }
// debug {
// minifyEnabled false
// signingConfig signingConfigs.debugConfig
// proguardFile 'proguard.cfg'
// zipAlignEnabled true
// renderscriptOptimLevel 5
//
// }
// }
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
// afterEvaluate {
// tasks.matching {
// it.name.startsWith('dex')
// }.each { dx ->
// if (dx.additionalParameters == null) {
// dx.additionalParameters = []
// }
// dx.additionalParameters += '--multi-dex' // enable multidex
//
// // optional
// // dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
// }
// }
// ...
dexOptions {
preDexLibraries = false
javaMaxHeapSize "2g"
}
}
混淆,分包
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.3.0'//统计应用方法数
}
}
//Error:(51, 13) Failed to resolve: org.apache.commons:commons-lang3:3.4
//缺少jar包,可以指定一个仓库下载(jcenter)
allprojects{
repositories{
jcenter()
mavenCentral()
}
}
apply plugin: 'android'
//apply plugin: 'com.getkeepsafe.dexcount'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':DXSP_Android')
compile 'com.android.support:multidex:1.0.1'
}
//—multi-dex:多 dex 打包的开关
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
dx.additionalParameters +='--set-max-idx-number=48000'//用于控制每一个dex的最大方法个数,写小一点可以产生好几个dex,默认每个 dex 中方法数最大为65536
// optional
// dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
}
}
android {
// compileSdkVersion 14
// buildToolsVersion "23.0.1"
// applicationId "com.foundersc.mobile.account"
compileSdkVersion 16
buildToolsVersion '21.1.2'
defaultConfig{
applicationId "com.hundsun.winner"
minSdkVersion 7
versionCode 1
versionName '2.0.0'
multiDexEnabled 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')
}
//去掉第三方jar包中重复的类
packagingOptions {
// exclude 'META-INF/LICENSE.txt'
// exclude 'META-INF/LICENSE'
// exclude 'META-INF/NOTICE'
// exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
//签名
signingConfigs {
//你自己的keystore信息
releaseConfig {
storeFile file("foundersc.keystore")
storePassword "founderSc20151015xiaofang"
keyAlias "foundersc"
keyPassword "founderSc20151015xiaofang"
}
debugConfig {
storeFile file("foundersc.keystore")
storePassword "founderSc20151015xiaofang"
keyAlias "foundersc"
keyPassword "founderSc20151015xiaofang"
}
}
buildTypes {
release{
minifyEnabled true
// shrinkResources true//资源需要在服务端返回后动态绑定,现在不需要,我不可能在代码里预定义这个资源引用,类似这种情况可能会找不到资源文件
signingConfig signingConfigs.releaseConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
debug{
minifyEnabled false
// shrinkResources true//资源需要在服务端返回后动态绑定,现在不需要,我不可能在代码里预定义这个资源引用,类似这种情况可能会找不到资源文件
signingConfig signingConfigs.debugConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
}
lintOptions {
abortOnError false
}
dexOptions {
//incremental true
// 对于dex 的--multi-dex 选项设置与预编译的library工程有冲突,因此如果你的应用中包含引用的lirary工程,需要将预编译设置为false
//否则会抛出com.android.dex.DexException: Library dex files are not supported in multi-dex mode异常
preDexLibraries = false
//设置虚拟机堆内存空间大小,避免在编译期间OOM
javaMaxHeapSize "2g"
}
}
另外的
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.3.0'//统计应用方法数
}
}
//Error:(51, 13) Failed to resolve: org.apache.commons:commons-lang3:3.4
//缺少jar包,可以指定一个仓库下载(jcenter)
allprojects{
repositories{
jcenter()
mavenCentral()
}
}
apply plugin: 'android'
//apply plugin: 'com.getkeepsafe.dexcount'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:multidex:1.0.1'
compile(name:'pulltorefresh-lib',ext:'aar')
}
//—multi-dex:多 dex 打包的开关
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
dx.additionalParameters +='--set-max-idx-number=48000'//用于控制每一个dex的最大方法个数,写小一点可以产生好几个dex,默认每个 dex 中方法数最大为65536
// optional
// dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
}
}
repositories{
flatDir{
dirs 'libs'
}
}
android {
// compileSdkVersion 14
// buildToolsVersion "23.0.1"
// applicationId "com.foundersc.mobile.account"
compileSdkVersion 14
buildToolsVersion '22.0.1'
defaultConfig{
applicationId "com.hundsun.winner"
minSdkVersion 14
versionCode 1
versionName '2.0.0'
multiDexEnabled 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')
}
//去掉第三方jar包中重复的类
packagingOptions {
// exclude 'META-INF/LICENSE.txt'
// exclude 'META-INF/LICENSE'
// exclude 'META-INF/NOTICE'
// exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
//签名
signingConfigs {
//你自己的keystore信息
releaseConfig {
storeFile file("wf.keystore")
storePassword "123456"
keyAlias "wfwf"
keyPassword "654321"
}
debugConfig {
storeFile file("wf.keystore")
storePassword "123456"
keyAlias "wfwf"
keyPassword "654321"
}
}
buildTypes {
release{
minifyEnabled true
// shrinkResources true//资源需要在服务端返回后动态绑定,现在不需要,我不可能在代码里预定义这个资源引用,类似这种情况可能会找不到资源文件
signingConfig signingConfigs.releaseConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
debug{
minifyEnabled false
// shrinkResources true//资源需要在服务端返回后动态绑定,现在不需要,我不可能在代码里预定义这个资源引用,类似这种情况可能会找不到资源文件
signingConfig signingConfigs.debugConfig
proguardFile 'proguard.cfg'
zipAlignEnabled true
renderscriptOptimLevel 5
}
}
lintOptions {
abortOnError false
}
dexOptions {
//incremental true
// 对于dex 的--multi-dex 选项设置与预编译的library工程有冲突,因此如果你的应用中包含引用的lirary工程,需要将预编译设置为false
//否则会抛出com.android.dex.DexException: Library dex files are not supported in multi-dex mode异常
preDexLibraries = false
//设置虚拟机堆内存空间大小,避免在编译期间OOM
javaMaxHeapSize "2g"
}
}
gradle大体内容的更多相关文章
- 深入理解Android之Gradle
深入理解Android之Gradle 格式更加精美的PDF版请到:http://vdisk.weibo.com/s/z68f8l0xTYrZt 下载 Gradle是当前非常"劲爆" ...
- Gradle史上最详细解析
转自:https://www.cnblogs.com/wxishang1991/p/5532006.html 郑重申明本文转自邓凡平老师的 http://www.infoq.com/cn/articl ...
- Gradle详细解析***
前言 对于Android工程师来说编译/打包等问题立即就成痛点了.一个APP有多个版本,Release版.Debug版.Test版.甚至针对不同APP Store都有不同的版本.在以前ROM的环境下, ...
- AndroidStudio配置gradle,让App自动签名
最近开发关于微信一系列功能,发现分享.支付必须要打包签名才能测试,太耽误事了,耗时耗力...在网上扒拉扒拉资料,发现有很多前辈都处理过类似问题,非常感谢大家的分享,参考链接:http://blog.c ...
- android gradle的全局管理
转自:https://github.com/stormzhang 工程目录下建立baseConfig.gradle文件 内容如下 ext { android = [compileSdkVersion: ...
- Android 开发必备知识:我和 Gradle 有个约会
腾讯Bugly特约作者:霍丙乾 0.讲个故事 0.1 Ant,我还真以为你是只蚂蚁 真正开始近距离接触编程其实是在2012年,年底的时候带我的大哥说,咱们这个 app 发布的时候手动构建耗时太久,研究 ...
- 外包采用Gradle生成多套app打包
目的:可修改app名称.icon.包名.接口地址及其它 一. 修改基本配置(包名.版本号等) 配置module下的build.gradle 添加productFlavors例如: produ ...
- 十分钟理解Gradle
一.什么是Gradle 简单的说,Gradle是一个构建工具,它是用来帮助我们构建app的,构建包括编译.打包等过程.我们可以为Gradle指定构建规则,然后它就会根据我们的“命令”自动为我们构建ap ...
- Android Studio系列教程五--Gradle命令详解与导入第三方包
Android Studio系列教程五--Gradle命令详解与导入第三方包 2015 年 01 月 05 日 DevTools 本文为个人原创,欢迎转载,但请务必在明显位置注明出处!http://s ...
随机推荐
- 省常中模拟 day1
第一题: 题目大意: 给出N个数的数列,如果相邻的两个数加起来是偶数,那么就可以把这两个数消掉,求最多能消掉多少数. 解题过程: 1.先自己手工模拟了几组数据,发现不管消除的顺序如何,最终剩下的是一定 ...
- bcopy函数
函数原型:void bcopy(const void *src, void *dest, int n) 头文件:#include <string.h> 函数功能:将src指针指 ...
- 将从数组中取到的字符串赋值给了UIImage导致的错误
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantStr ...
- Android Studio 1.5错误
Error:Unable to start the daemon process: could not reserve enough space for object heap. Please ass ...
- ireport开发报表,Java和JSP端如何集成
Java端: @RequestMapping("/report") public String report() { return "/credit/report/rep ...
- 避免每次输入bundler Exec命令
bundle在ruby的世界里是个好东西,它可以用来管理应用程序的依赖库.它能自动的下载和安装指定的gem,也可以随时更新指定的gem. rvm则是一个命令行工具,能帮助你轻松的安装,管理多个ruby ...
- ASP.Net Session, Cookie, Cache的区别
Session—管理用户会话状态 什么是状态管理? 指对同一页或不同页的多个请求维护状态和页信息的过程 为什么要进行状态管理? Web页是无状态的,不保存任何用户请求信息,而且到服务器的每一往返过程都 ...
- kallisto:Near-optimal RNA-Seq quantification
Near-optimal RNA-Seq quantification https://pachterlab.github.io/kallisto 文章标题: Pseudoalignment fo ...
- 关于配置服务器(IIS7)
服务器Server2003 ,无限开机动画慢动作重播,一怒而重装server2008 然,重点就是系统装好了 IIS装好了 ,发布网站 开始各种错了!!! 1.第一个错 额,错误信息说 :由于权限不足 ...
- sqlserver sum 和count在关于进行统计时的区别
sum是对内容的数量进行相加,count 对表行数 对象进行统计 在使用 case 时,如 select subject,count(case when score>80 then score ...