1. 程式人生 > >Gradle 模板配置

Gradle 模板配置

color top sdk -- mod face share wrapper config

對於新手配置Gradle是一件很痛苦的事,記住二句話絕對搞定

1.在Gradle-->gradle-wrapper.properties中配置distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip ;//這個是modle的版本

2.在build.gradle中更改classpath ‘com.android.tools.build:gradle:2.2.2‘ //這個是工具用到的版本

Example:

apply plugin: ‘com.android.application‘
apply plugin: ‘android-apt‘

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
//極光推送配置
sourceSets {
main {
jniLibs.srcDirs = [‘libs‘]
assets.srcDirs = [‘src/main/assets‘, ‘src/main/assets/‘]
}
}

buildTypes {
release {
minifyEnabled true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.pro‘
}
debug {
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.pro‘
}
}
signingConfigs {
debug {
storeFile file(‘hanyi.jks‘)
storePassword "0213abcd"
keyAlias "hanyi"
keyPassword "0213abcd"
}
}

lintOptions {
checkReleaseBuilds false
abortOnError false
}

}

dependencies {
compile fileTree(include: [‘*.jar‘], dir: ‘libs‘)
compile ‘com.android.support:appcompat-v7:23.4.0‘
compile ‘com.android.support:support-v4:23.4.0‘
compile ‘com.android.support:design:24.2.0‘

//json解析Gson,fastjson
compile ‘com.google.code.gson:gson:2.7‘
compile ‘com.alibaba:fastjson:1.2.21‘

//圖片加載庫Glide
compile ‘com.github.bumptech.glide:glide:3.7.0‘
compile ‘com.facebook.fresco:fresco:0.12.0‘//我後加的

compile ‘com.zxy.android:recovery:0.0.8‘//crash後處理,在banner項目裏有用到,沈浸式是用的這個

//輪播圖庫
compile ‘com.youth.banner:banner:1.3.3‘
testCompile ‘junit:junit:4.12‘
//compile ‘com.recker.flybanner:flybanner:1.3‘ //enjoy用的

//okhttputils庫
compile ‘com.zhy:okhttputils:2.6.2‘
compile ‘com.squareup.okhttp3:okhttp:3.4.1‘

// butterknife 關聯類庫
compile ‘com.jakewharton:butterknife:8.4.0‘
apt ‘com.jakewharton:butterknife-compiler:8.4.0‘

//EventBus
compile ‘org.greenrobot:eventbus:3.0.0‘
// BaseRecyclerView適配器
compile ‘com.github.CymChad:BaseRecyclerViewAdapterHelper:2.5.0‘

//友盟登錄分享
compile files(‘libs/umeng_social_api.jar‘)
compile files(‘libs/umeng_social_net.jar‘)
compile files(‘libs/SocialSDK_QQ_Simplify.jar‘)
compile files(‘libs/SocialSDK_Sina_Simplify.jar‘)
compile files(‘libs/SocialSDK_WeChat_Simplify.jar‘)
compile files(‘libs/umeng_social_tool.jar‘)
compile files(‘libs/umeng_social_shareview.jar‘)

//融雲即時通訊
compile project(‘:Rong_Cloud_Android_IMKit_SDK_v2_7_3_stable‘)

//極光推送
compile files(‘libs/jpush-android-2.2.0.jar‘)

//Zxing
compile ‘cn.yipianfengye.android:zxing-library:2.1‘

//6.0添加權限
compile ‘com.yanzhenjie:permission:1.0.3‘
compile ‘pub.devrel:easypermissions:0.3.0‘//個人推薦用這個

}

Gradle 模板配置