当前位置:   article > 正文

Android Studio--Gradle配置详解_android studio 配置gradle-plugin

android studio 配置gradle-plugin

build.gradle完整源码

第一步奏,打开app moder中的 build.gradle 文件


/**
* 常量定义
*/
def AppPackageName="com.apkdemo.demo";/* 包名:必须改当前包名 */
def AppSigningKey="/Users/oscar/Desktop/TestApkKey/gradledemo.jks";/* APK 签名key文件目录 */
def StorePassword="123123"/* APK 签名key密码(第一重密码) */
def KeyAlias='123321'/** APK 签名key别名 */
def KeyPassword="123123"/* APK 签名key别名密码(第二重密码) */

apply plugin:'com.android.application'
apply plugin:'com.neenbedankt.android-apt'

android{
compileSdkVersion21
buildToolsVersion"20.0.0"

defaultConfig{
applicationId AppPackageName
minSdkVersion15
targetSdkVersion21
versionCode1
versionName"1.0"
}

compileOptions{
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes{
release{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}


/**
* AA注解Apt配置
*/
apt{
arguments{
androidManifestFile variant.processResources.manifestFile
resourcePackageName AppPackageName
}
}

/**
*排除
*/
android{
packagingOptions{
exclude'META-INF/LICENSE.txt'
}
}

/**
* .so文件的导入
*/
task copyNativeLibs(type:Copy){
from fileTree(dir:'libs',include:'armeabi/*.so')into'build/lib'
from fileTree(dir:'libs',include:'armeabi-v7a/*.so')into'build/lib'
from fileTree(dir:'libs',include:'x86/*.so')into'build/lib'
}

/**
* 支持库
*/
dependencies{
compile fileTree(dir:'libs',include:['*.jar'])
compile'com.android.support:appcompat-v7:21.0.0'
//框架系列

apt'org.androidannotations:androidannotations:3.2+'// AA注解库1
compile'org.androidannotations:androidannotations-api:3.2+'// AA注解库2

// //请求系列
// compile 'com.loopj.android:android-async-http:1.4.5+' //Android异步Http请求
// //动画系列
// compile 'com.nineoldandroids:library:2.4.0+' //Nine Old Androids 将Android 3.0(Honeycomb)所有动画API兼容到Android1.0
// //缓存系列
// compile 'com.squareup.picasso:picasso:2.3.3' //picasso图片缓存
// //控件系列
 compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.1' //按钮上显示进度状态。(最低需要andriud版本10)
 compile 'de.hdodenhof:circleimageview:1.1.1' //CircleImageView实现带边框圆形头像.
 compile 'com.daimajia.numberprogressbar:library:1.1@aar' //NumberProgressBar文字进度跟随进度条展示。(最低需要andriud版本10)
 compile 'info.hoang8f:fbutton:1.0.5' //FButton FButton的是Android与“平板UI”的概念自定义按钮。(最低需要andriud版本9)
 compile 'pl.droidsonroids.gif:android-gif-drawable:1.0.+' //用jni实现的,
 compile 'com.nhaarman.supertooltips:library:3.0.+' //supertooltips 带动画效果的Tips显示
 compile 'org.holoeverywhere:slidingmenu:1.4.2+' //SlidingMenu (依赖actiomnBar)滑出式菜单,通过拖动屏幕边缘滑出菜单.
// //工具系列
// compile 'com.alibaba:fastjson:+' //fastjson 目前比较快的json解析库
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95

第二步奏,打开项目空间全局文件 build.gradle 复制以下

buildscript{
repositories{
mavenCentral()
}
dependencies{
classpath'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath'com.android.tools.build:gradle:0.14.2'


}
}
allprojects{
repositories{
mavenCentral()
}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

注意事项

dependencies 代码块里面的jar包配置是根据自己的需要而定的,没用的jar包配置或者android系统版本不支持的jar包建议注释掉,以免冲突无法构建。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/269873
推荐阅读
相关标签
  

闽ICP备14008679号