美文网首页
依赖的抽取

依赖的抽取

作者: 君袅 | 来源:发表于2019-03-30 14:23 被阅读0次

直接在项目中创建config.gradle文件用来存放抽取的依赖

ext {


    android = [
            //sdk版本号
            compileSdkVersion    : 27,
            //最小版本号
            minSdkVersion        : 17,
            //最大版本号
            targetSdkVersion     : 27,
            //版本码
            versionCode          : 1,
            //版本名称
            versionName          : "1.0",

            androidSupportVersion: "27.1.1",
            retrofitVersion      : "2.3.0",
           butterknifeVersion   : "10.2.1",
            rxJavaVersion        : "2.0.7",
            rxAndroidVersion     : "2.0.1",
            okhttpVersion        : "3.12.0",
            butterknifeVersion   : "8.8.1",
            SmartRefreshVersion  : "1.0.4-7",
            bannerVersion        : "1.4.10",
            xrecyclerviewVersion : "1.5.9",
            glideVersion         : "4.8.0",
            glideTransformVersion: "3.3.0",
            gsonVersion          : "2.6.2",
            materialsearchVersion: "1.4.0",
            stickyHeaderVersion  : "1.0.1",
            eventbusVersion      : "3.1.1",
            jsoupVersion         : "1.11.3",
            disklrucacheVersion  : "2.0.2",
            circleImageVersion   : "2.1.0",
            greendaoVersion      : "3.2.0",
            recyclerviewVersion  : "27.1.1",

            recyclerview         : "1.1.0",

    ]



    dependencies = [
             //兼容v7包
            "appcompat-v7"              : "com.android.support:appcompat-v7:${android["androidSupportVersion"]}",
            //tablayout包
            "design"                    : "com.android.support:design:${android["androidSupportVersion"]}",

            "retrofit"                  : "com.squareup.retrofit2:retrofit:${android["retrofitVersion"]}",
            "retrofit-adapter-rxjava"   : "com.squareup.retrofit2:adapter-rxjava2:${android["retrofitVersion"]}",
            "retrofit-converter-gson"   : "com.squareup.retrofit2:converter-gson:${android["retrofitVersion"]}",

            "rxjava"                    : "io.reactivex.rxjava2:rxjava:${android["rxJavaVersion"]}",
            "rxandroid"                 : "io.reactivex.rxjava2:rxandroid:${android["rxAndroidVersion"]}",

            "okhttp"                    : "com.squareup.okhttp3:okhttp:${android["okhttpVersion"]}",

            "butterknife"               : "com.jakewharton:butterknife:${android["butterknifeVersion"]}",
            "butterknife-compiler"      : "com.jakewharton:butterknife-compiler:${android["butterknifeVersion"]}",

            "SmartRefreshLayout"        : "com.scwang.smartrefresh:SmartRefreshLayout:${android["SmartRefreshVersion"]}",
            "SmartRefreshHeader"        : "com.scwang.smartrefresh:SmartRefreshHeader:${android["SmartRefreshVersion"]}",

            "banner"                    : "com.youth.banner:banner:${android["bannerVersion"]}",

            "cardView"                  : "com.android.support:cardview-v7:${android["androidSupportVersion"]}",

            "xrecyclerview"             : "com.jcodecraeer:xrecyclerview:${android["xrecyclerviewVersion"]}",

            "glide"                     : "com.github.bumptech.glide:glide:${android["glideVersion"]}",
            "glideCompiler"       : "com.github.bumptech.glide:compiler:${android["glideVersion"]}",

            "transformations"           : "jp.wasabeef:glide-transformations:${android["glideTransformVersion"]}",

            "gson"                      : "com.google.code.gson:gson:${android["gsonVersion"]}",

            "materialsearchview"        : "com.miguelcatalan:materialsearchview:${android["materialsearchVersion"]}",

            "StickyHeaderDecoration"    : "com.github.qdxxxx:StickyHeaderDecoration:${android["stickyHeaderVersion"]}",

            "eventbus"                  : "org.greenrobot:eventbus:${android["eventbusVersion"]}",

            "jsoup"                     : "org.jsoup:jsoup:${android["jsoupVersion"]}",

            "disklrucache"              : "com.jakewharton:disklrucache:${android["disklrucacheVersion"]}",

            "circleimageview"           : "de.hdodenhof:circleimageview:${android["circleImageVersion"]}",

            "greendao"                  : "org.greenrobot:greendao:${android["greendaoVersion"]}",
            "greendao-generator"        : "org.greenrobot:greendao-generator:${android["greendaoVersion"]}",

 "recyclerview"            : "androidx.recyclerview:recyclerview:${android["recyclerview"]}",
    ]


}

在项目的build.gradle中进行连接 buildscript 的上面


apply from : "config.gradle"

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        

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

module中使用依赖

apply plugin: 'com.android.application'

android {
    //版本号
    compileSdkVersion rootProject.ext.android.compileSdkVersion

    defaultConfig {
        applicationId "com.example.zhao.navigation"

        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode rootProject.ext.android.versionCode
        versionName rootProject.ext.android.versionName
 multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation rootProject.ext.dependencies["appcompat-v7"]
    implementation rootProject.ext.dependencies["design"]
    implementation rootProject.ext.dependencies["retrofit"]
    implementation rootProject.ext.dependencies["retrofit-adapter-rxjava"]
    implementation rootProject.ext.dependencies["retrofit-converter-gson"]
    implementation rootProject.ext.dependencies["rxjava"]
    implementation rootProject.ext.dependencies["rxandroid"]
    implementation rootProject.ext.dependencies["okhttp"]

    implementation rootProject.ext.dependencies["butterknife"]
    annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]

    implementation rootProject.ext.dependencies["SmartRefreshLayout"]
    implementation rootProject.ext.dependencies["SmartRefreshHeader"]
    implementation rootProject.ext.dependencies["banner"]
    implementation rootProject.ext.dependencies["cardView"]
    implementation rootProject.ext.dependencies["xrecyclerview"]

    implementation rootProject.ext.dependencies["glide"]
    annotationProcessor rootProject.ext.dependencies["glideCompiler"]

    implementation rootProject.ext.dependencies["transformations"]
    implementation rootProject.ext.dependencies["gson"]
    implementation rootProject.ext.dependencies["materialsearchview"]

    implementation rootProject.ext.dependencies["eventbus"]
    implementation rootProject.ext.dependencies["jsoup"]
    implementation rootProject.ext.dependencies["disklrucache"]
    implementation rootProject.ext.dependencies["circleimageview"]
    implementation rootProject.ext.dependencies["greendao"]
    implementation rootProject.ext.dependencies["greendao-generator"]

}

相关文章

  • 依赖的抽取

    直接在项目中创建config.gradle文件用来存放抽取的依赖 在项目的build.gradle中进行连接 bu...

  • iOS集成 Flutter 混合工程开发二

    Flutter依赖抽取模块 将Flutter的依赖抽取为一个Flutter依赖库发布到远程,供纯Native工程引...

  • 知识图谱学习笔记(八)——事件抽取

    事件抽取 1.事件抽取的任务定义 事件抽取是信息抽取中的难点问题事件抽取依赖实体抽取和关系抽取相较于实体抽取和关系...

  • apply plugin和plugins{}的区别

    本人在抽取模块gradle文件时,将插件以plugins{}抽取时,插件会依赖不上。但是以apply plugin...

  • 混合工程与持续集成

    Flutter混合工程中解除Native工程对Flutter的直接依赖的具体解决方法将Flutter的依赖抽取为一...

  • WWW 2017|知识库支持下的归类实体与关系联合抽取

    实体以及它们之间关系的抽取对于理解海量文本语料库来说是非常重要的。传统的实体关系抽取系统都依赖于人工标注的训练语料...

  • IOC真的有必要吗

    IOC将实例依赖抽取出来放到配置文件中管理,但是思考这么一个问题:如果只是将实例化抽取出来放到配置文件中,和在代码...

  • 抽取新闻相关信息

    抽取新闻标题 抽取新闻时间 抽取新闻内文 抽取新闻评论数 抽取新闻id

  • 知识抽取-事件抽取

    此文为转载,原文链接:知识抽取-事件抽取 - 徐阿衡的文章 - 知乎https://zhuanlan.zhihu....

  • 关系抽取(分类)总结

    关系抽取(分类)总结 关系抽取研究现状 基于路径的实体图关系抽取模型 ChineseNRE 关系抽取(关系学习)综...

网友评论

      本文标题:依赖的抽取

      本文链接:https://www.haomeiwen.com/subject/ragjbqtx.html