模块化以及进行模块化同步

ext {
    //是都独立模块
    isModuleApp=false
    //模块类型处理
    moduleType="com.android.library"
    if (isModuleApp){
        moduleType="com.android.application"
    }
    sdkconfig=[
            compileSdk:33,
            minSdk:24,
            targetSdk:33
    ]


    versionNameconfig=
        [
                appversionName:"1.0",
                splashverionName: "1.0",
                mainverionName:"1.0"
        ]

    versionCodeconfig=[
            appversionCode:1,
            splashversionCode:1,
            mainverionCode:1
    ]

    namespaceconfig=[
            appnamespace:'com.example.zhuanga4day1',
            lib_baseappnamespace:'com.example.zhuanga4day1',
            lib_commonappnamespace:'com.example.zhuanga4day1',
            lib_httpappnamespace:'com.example.zhuanga4day1',
            moduleappnamespace:'com.example.zhuanga4day1',
            mainappnamespace:'com.example.module_maiin'

    ]
    appIdconfig=[
            appId:"com.example.zhuanga4day1",
            moduleId:"com.example.module",
            mainId:"com.example.module_maiin"
    ]
    //依赖版本配置
    dependsVer = [
            roomVersion: "2.5.0",
            navVersion: "2.5.3",
            hiltVersion: "2.44",
            arouterVersion: "1.5.2",
            refreshVersion: "2.0.5",
    ]
    //kapt编译器配置
    kaptConfig = [
            roomCompiler: "androidx.room:room-compiler:${dependsVer.roomVersion}",
            hiltCompiler: "com.google.dagger:hilt-compiler:${dependsVer.hiltVersion}",
            arouterCompiler: "com.alibaba:arouter-compiler:${dependsVer.arouterVersion}",
    ]


    depends = [

            //基础依赖
            kotlinCoreKtx: 'androidx.core:core-ktx:1.7.0',
            appCompat: 'androidx.appcompat:appcompat:1.6.1',
            material: 'com.google.android.material:material:1.8.0',
            constraintLayout: 'androidx.constraintlayout:constraintlayout:2.1.3',

            //测试依赖
            junit: 'junit:junit:4.13.2',
            extJunit: 'androidx.test.ext:junit:1.1.3',
            espressoCore: 'androidx.test.espresso:espresso-core:3.4.0',

            //AspectJ面向切面编程
            aspectJ: 'org.aspectj:aspectjrt:1.9.7',

            //ViewPager2
            viewpager2: "androidx.viewpager2:viewpager2:1.0.0",

            //烈焰弹幕
            danmaku: 'com.github.ctiao:DanmakuFlameMaster:0.9.25',

            //Popup
            xpopup: 'com.github.li-xiaojun:XPopup:2.0.0',

            //使用activityViewModels()或viewModels()时需要
            activityKtx: "androidx.activity:activity-ktx:1.5.1",
            fragmentKtx: "androidx.fragment:fragment-ktx:1.5.5",

            kotlinReflect: "org.jetbrains.kotlin:kotlin-reflect:1.9.0",
            coroutines: 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3',

            livedataKtx: 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1',
            viewmodelKtx: 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1',
            lifecycleKtx: 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1',

            //万能适配器
            baseAdapterHelper: 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.0',

            //左右滑动布局
            swipeRevealLayout: 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1',

            //下拉刷新和加载更多
            refreshLayoutKernel: "io.github.scwang90:refresh-layout-kernel:${dependsVer.refreshVersion}",
            refreshHeaderClassics: "io.github.scwang90:refresh-header-classics:${dependsVer.refreshVersion}",
            refreshFooterClassics: "io.github.scwang90:refresh-footer-classics:${dependsVer.refreshVersion}",

            //arouter
            arouter: "com.alibaba:arouter-api:${dependsVer.arouterVersion}",

            //Hilt
            hilt: "com.google.dagger:hilt-android:${dependsVer.hiltVersion}",

            // eventbus
            eventBus: 'org.greenrobot:eventbus:3.3.1',

            //rxpermissions
            rxpermissions: 'com.github.tbruyelle:rxpermissions:0.11',

            // okhttp
            okhttp: 'com.squareup.okhttp3:okhttp:4.2.2',
            loggingInterceptor: 'com.squareup.okhttp3:logging-interceptor:3.9.1',

            // retrofit
            retrofit: 'com.squareup.retrofit2:retrofit:2.9.0',
            retrofitConverterGson: 'com.squareup.retrofit2:converter-gson:2.9.0',
            retrofitAdapterRxJava: 'com.squareup.retrofit2:adapter-rxjava2:2.5.0',

            // Glide
            glide: 'com.github.bumptech.glide:glide:4.15.1',
            glideTransfor: 'jp.wasabeef:glide-transformations:4.3.0',

            // Banner
            banner: 'com.youth.banner:banner:1.4.10',
            textBanner: 'com.superluo:textbannerview:1.0.5',

            // 通用工具类
            utilCodex: 'com.blankj:utilcodex:1.31.1',
            //MMKV存储工具
            mmkv: 'com.tencent:mmkv:1.3.1',
            //分包加载
            multidex: 'com.android.support:multidex:1.0.3',

            //圆形图片组件
            circleImageView: 'de.hdodenhof:circleimageview:3.1.0',

            //Room数据库
            roomRuntime: "androidx.room:room-runtime:${dependsVer.roomVersion}",

            // Navigation
            navigationFragmentKtx: "androidx.navigation:navigation-fragment-ktx:${dependsVer.navVersion}",
            navigationUiKtx: "androidx.navigation:navigation-ui-ktx:${dependsVer.navVersion}",

    ]
}//进行模块总结,以及相同的性质,进行定义新的名字等等,
apply plugin:'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-kapt'
android {

    compileSdk sdkconfig.compileSdk

    defaultConfig {
        minSdk sdkconfig.minSdk
        targetSdk sdkconfig.targetSdk

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

//新的grdule里面进行定义,以防混乱

一共6个模块等等,加上它本身app,进行编译

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值