你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

AndroidStudio Gradle第三依赖统一管理,怒斩获了30家互联网公司offer

2021/12/23 12:23:26

supportV4 : “com.android.support:support-v4:${dependVersion.support}”,

appcompatV7 : “com.android.support:appcompat-v7:${dependVersion.support}”,

design : “com.android.support:design:${dependVersion.support}”,

junit : “junit:junit:4.12”,

//------------- 测试 -------------

espresso : “com.android.support.test.espresso:espresso-core:2.2.2”,

// ------------- 网络请求 -------------

okhttp : ‘com.squareup.okhttp3:okhttp:3.3.1’,

retrofit : ‘com.squareup.retrofit2:retrofit:2.1.0’,

// ------------- 图片加载 -------------

fresco : ‘com.facebook.fresco:fresco:0.11.0’,

animatedGif : ‘com.facebook.fresco:animated-gif:0.12.0’,

picasso : ‘com.squareup.picasso:picasso:2.5.2’,

photoView : ‘com.github.chrisbanes:PhotoView:1.3.1’,

// ------------- RxAndroid -------------

rxAndroid : ‘io.reactivex:rxandroid:1.2.1’,

rxJava : ‘io.reactivex:rxjava:1.2.2’,

// ------------- json解析 -------------

fastJson : ‘com.alibaba:fastjson:1.1.54.android’,

gson : ‘com.google.code.gson:gson:2.8.0’,

// ------------- log打印工具 -------------

logger : ‘com.orhanobut:logger:1.15’,

greendao : ‘org.greenrobot:greendao:3.2.0’,

// ------------- ButterKnife -------------

butterknife : ‘com.jakewharton:butterknife:8.4.0’,

butterknifeCompiler : ‘com.jakewharton:butterknife-compiler:8.4.0’,

// ------------- LeakCanary -------------

leakcanaryAndroid : ‘com.squareup.leakcanary:leakcanary-android:1.5’,

leakcanaryAndroidNoOp: ‘com.squareup.leakcanary:leakcanary-android-no-op:1.5’,

]

}

2、在我们的project中的build.gradle中添加

==============================

apply from: “config.gradle”

3、在我们的module的build.gradle中引入

============================

这是引入之前的gradle

apply plugin: ‘com.android.application’

android {

《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》

【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享

compileSdkVersion 23

buildToolsVersion “24.0.2”

defaultConfig {

applicationId “com.bandeng.bandeng”

minSdkVersion 15

targetSdkVersion 23

versionCode 1

versionName “1.0”

testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’

}

}

}

dependencies {

compile fileTree(dir: ‘libs’, include: [’*.jar’])

androidTestCompile(“com.android.support.test.espresso:espresso-core:2.2.2”, {

exclude group: ‘com.android.support’, module: ‘support-annotations’

})

compile “com.android.support:appcompat-v7:23.4.0”

testCompile “junit:junit:4.12”

compile “com.android.support:design:23.4.0”

}

改造之后的gradle

apply plugin: ‘com.android.application’

android {

compileSdkVersion rootProject.ext.android.compileSdkVersion

buildToolsVersion rootProject.ext.android.buildToolsVersion

defaultConfig {

applicationId “com.bandeng.bandeng”

minSdkVersion rootProject.ext.android.minSdkVersion

targetSdkVersion rootProject.ext.android.targetSdkVersion

versionCode rootProject.ext.android.versionCode

versionName rootProject.ext.android.versionName

testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’

}

}

}

dependencies {

compile fileTree(dir: ‘libs’, include: [’*.jar’])

androidTestCompile(rootProject.ext.dependencies.espresso, {

exclude group: ‘com.android.support’, module: ‘support-annotations’

})

compile rootProject.ext.dependencies.appcompatV7

testCompile rootProject.ext.dependencies.junit