JessYanCoding / MVPArms

⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).
Apache License 2.0
10.29k stars 2.39k forks source link

萌新求带,首次编译和增量编译速度都极慢,框架能救吗? #277

Closed LinXueyuanStdio closed 5 years ago

LinXueyuanStdio commented 5 years ago

萌新求带!

项目引用了80多个第三方库,6个SDK,按框架要求的架构拆分出模块13个。

然后第一次全量编译一般在 1 个小时左右,模块的增量编译耗时在10分钟左右。发布版SDK有 30M。发布的时候编译更难受,还要混淆,耗时30分钟左右。

编译时间集中在compileJavaWithJavac这里,不过貌似Arouter,Glide,butterknife,dagger,rx一系也耗时挺久的?

gradle的优化都做了,分配给AS有4g堆栈,平时占内存是 1700M 左右,所有库都走离线缓存了,机器是surface 8g+256g,GTX 1050。

这么慢正常吗。。。

要不要重新整合成一个app一把梭?调试一次10分钟真难受😭嘤嘤嘤qaq

LinXueyuanStdio commented 5 years ago

setting.gradle

include ':app'
include ':component:CommonSDK',
        ':component:CommonData',
        ':component:CommonRes',
        ':component:CommonArms',
        ':component:lib',
        ':component:styles',
        ':component:tools'
include ':widgets:widget-colorpicker',
        ':widgets:widget-burstlink',
        ':widgets:widget-calendar',
        ':widgets:widget-messagelist',
        ':widgets:widget-chatinput',
        ':widgets:widget-edittext'
include ':modules:module-login',
        ':modules:module-welcome',
        ':modules:module-main',
        ':modules:module-master',
        ':modules:module-search',
        ':modules:module-about',
        ':modules:module-user',
        ':modules:module-file-explorer',
        ':modules:module-rawtext-editor',
        ':modules:module-csv-editor',
        ':modules:module-book-reader',
        ':modules:module-md-editor',
//        ':modules:module-github',
        ':modules:module-keyboard'
include ':skin:skin-night'

主 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "config.gradle"

buildscript {
    ext {
        supportVersion = "27.1.1"
        retrofit = '2.3.0'
        gms = "11.8.0"
        butterKnifeVersion = '8.5.1'
        state_version = '1.2.0'
        lombokVersion = '1.16.20'
        thirtyinchVersion = '0.8.0'
        junitVersion = '4.12'
        mockitoVersion = '1.10.19'
        assertjVersion = '2.5.0'
        espresseVersion = '2.2.2'
        requery = '1.3.2'

        kotlin_version = '1.2.71'
        commonmark = '0.10.0'
        glideVersion = '4.8.0'

        markwonVersion = "2.0.0"

        permissionsVersion = '3.2.0'
    }
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
        classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
        classpath 'com.apollographql.apollo:gradle-plugin:0.4.1'
        classpath 'com.novoda:gradle-build-properties-plugin:0.3'
        classpath "com.alibaba:arouter-register:1.0.2"
        classpath 'net.ricecode:string-similarity:1.0.0'
        // 注册MobSDK
//        classpath "com.mob.sdk:MobSDK:2018.0319.1724"
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url 'https://jitpack.io' }
        maven { url 'https://dl.bintray.com/azeesoft/maven' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' }
        maven { url 'http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/' }
        maven { url 'https://github.com/psiegman/mvn-repo/raw/master/releases' }
    }
}
configurations.all {
    //每隔24小时检查远程依赖是否存在更新
    resolutionStrategy.cacheChangingModulesFor 240, 'hours'
    // 采用动态版本声明的依赖缓存24小时
    resolutionStrategy.cacheDynamicVersionsFor 240, 'hours'//'seconds'
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}

config.gradle

ext {
    android = [
            compileSdkVersion: 27,
            buildToolsVersion: "27.0.3",
            minSdkVersion    : 19,
            targetSdkVersion : 27,
            versionCode      : 15,
            versionName      : "0.4.2"
    ]

    version = [
            androidSupportSdkVersion: "27.1.1",
            constraintVersion       : "1.1.2",
            butterknifeVersion      : "8.8.1",
            okhttpVersion           : "3.11.0",
            retrofitVersion         : "2.4.0",
            rxJavaVersion           : "1.3.8",
            rxAndroidVersion        : "1.2.1",
            rxJava2Version          : "2.2.1",
            rxAndroid2Version       : "2.1.0",
            arouterVersion          : "1.4.0",
            arouterCompilerVersion  : "1.2.1",
            glideVersion            : "4.8.0",
            gsonVersion             : "2.8.5",
            eventBusVersion         : "3.1.1",
            timberVersion           : "4.7.1",
            retrofitSdkVersion      : "2.4.0",
            dagger2SdkVersion       : "2.15",
            glideSdkVersion         : "4.8.0",
            butterknifeSdkVersion   : "8.8.1",
            rxlifecycleSdkVersion   : "1.0",
            rxlifecycle2SdkVersion  : "2.2.1",
            espressoSdkVersion      : "3.0.1",
            canarySdkVersion        : "1.5.4",
            canaryVersion           : "1.6.1",

            supportVersion          : "27.1.1",
            retrofit                : '2.3.0',
            gms                     : "11.8.0",
            butterKnifeVersion      : '8.5.1',
            state_version           : '1.2.0',
            lombokVersion           : '1.16.20',
            thirtyinchVersion       : '0.8.0',
            junitVersion            : '4.12',
            mockitoVersion          : '1.10.19',
            assertjVersion          : '2.5.0',
            espresseVersion         : '2.2.2',
            requery                 : '1.3.2',

            kotlin_version          : '1.2.71',
            commonmark              : '0.10.0',
//            glideVersion : '3.7.0',

            permissionsVersion      : '3.2.0',
    ]

    dependencies = [
            //support
            "appcompat-v7"                 : "com.android.support:appcompat-v7:${version["androidSupportSdkVersion"]}",
            "design"                       : "com.android.support:design:${version["androidSupportSdkVersion"]}",
            "support-v4"                   : "com.android.support:support-v4:${version["androidSupportSdkVersion"]}",
            "cardview-v7"                  : "com.android.support:cardview-v7:${version["androidSupportSdkVersion"]}",
            "annotations"                  : "com.android.support:support-annotations:${version["androidSupportSdkVersion"]}",
            "recyclerview-v7"              : "com.android.support:recyclerview-v7:${version["androidSupportSdkVersion"]}",

            //network
            "retrofit"                     : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
            "retrofit-converter-gson"      : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}",
            "retrofit-adapter-rxjava"      : "com.squareup.retrofit2:adapter-rxjava:${version["retrofitSdkVersion"]}",
            "retrofit-adapter-rxjava2"     : "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
            "okhttp3"                      : "com.squareup.okhttp3:okhttp:3.10.0",
            "okhttp-urlconnection"         : "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
            "glide"                        : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
            "glide-compiler"               : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}",
            "glide-loader-okhttp3"         : "com.github.bumptech.glide:okhttp3-integration:${version["glideSdkVersion"]}",
            "picasso"                      : "com.squareup.picasso:picasso:2.5.2",

            //view
            "autolayout"                   : "com.zhy:autolayout:1.4.5",
            "butterknife"                  : "com.jakewharton:butterknife:${version["butterknifeSdkVersion"]}",
            "butterknife-compiler"         : "com.jakewharton:butterknife-compiler:${version["butterknifeSdkVersion"]}",
            "pickerview"                   : "com.contrarywind:Android-PickerView:3.2.5",
            "photoview"                    : "com.github.chrisbanes.photoview:library:1.2.3",
            "numberprogressbar"            : "com.daimajia.numberprogressbar:library:1.2@aar",
            "nineoldandroids"              : "com.nineoldandroids:library:2.4.0",
            "paginate"                     : "com.github.markomilos:paginate:0.5.1",
            "vlayout"                      : "com.alibaba.android:vlayout:1.1.0@aar",
            "lottie"                       : "com.airbnb.android:lottie:2.5.4",

            //rx1
            "rxandroid"                    : "io.reactivex:rxandroid:1.2.1",
            "rxjava"                       : "io.reactivex:rxjava:1.3.0",
            "rxlifecycle"                  : "com.trello:rxlifecycle:${version["rxlifecycleSdkVersion"]}",
            "rxlifecycle-components"       : "com.trello:rxlifecycle-components:${version["rxlifecycleSdkVersion"]}",
            "rxcache"                      : "com.github.VictorAlbertos.RxCache:runtime:1.7.0-1.x",
            "rxcache-jolyglot-gson"        : "com.github.VictorAlbertos.Jolyglot:gson:0.0.3",
            "rxbinding-recyclerview-v7"    : "com.jakewharton.rxbinding:rxbinding-recyclerview-v7:1.0.1",
            "rxpermissions"                : "com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar",
            "rxerrorhandler"               : "me.jessyan:rxerrorhandler:1.0.1",

            //rx2
            "rxandroid2"                   : "io.reactivex.rxjava2:rxandroid:2.0.2",
            "rxjava2"                      : "io.reactivex.rxjava2:rxjava:2.1.12",
            "rxlifecycle2"                 : "com.trello.rxlifecycle2:rxlifecycle:${version["rxlifecycle2SdkVersion"]}",
            "rxlifecycle2-android"         : "com.trello.rxlifecycle2:rxlifecycle-android:${version["rxlifecycle2SdkVersion"]}",
            "rxlifecycle2-components"      : "com.trello.rxlifecycle2:rxlifecycle-components:${version["rxlifecycle2SdkVersion"]}",
            "rxcache2"                     : "com.github.VictorAlbertos.RxCache:runtime:1.8.3-2.x",
            "rxpermissions2"               : "com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar",
            "rxerrorhandler2"              : "me.jessyan:rxerrorhandler:2.1.1",

            //tools
            "dagger2"                      : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}",
            "dagger2-android"              : "com.google.dagger:dagger-android:${version["dagger2SdkVersion"]}",
            "dagger2-android-support"      : "com.google.dagger:dagger-android-support:${version["dagger2SdkVersion"]}",
            "dagger2-compiler"             : "com.google.dagger:dagger-compiler:${version["dagger2SdkVersion"]}",
            "dagger2-android-processor"    : "com.google.dagger:dagger-android-processor:${version["dagger2SdkVersion"]}",
            "androideventbus"              : "org.simple:androideventbus:1.0.5.1",
            "otto"                         : "com.squareup:otto:1.3.8",
            "gson"                         : "com.google.code.gson:gson:2.8.2",
            "multidex"                     : "com.android.support:multidex:1.0.1",
            "javax.annotation"             : "javax.annotation:jsr250-api:1.0",
            "arouter"                      : "com.alibaba:arouter-api:1.3.1",
            "arouter-compiler"             : "com.alibaba:arouter-compiler:1.1.4",
            "progressmanager"              : "me.jessyan:progressmanager:1.5.0",
            "retrofit-url-manager"         : "me.jessyan:retrofit-url-manager:1.4.0",
            "lifecyclemodel"               : "me.jessyan:lifecyclemodel:1.0.1",

            //test
            "junit"                        : "junit:junit:4.12",
            "androidJUnitRunner"           : "android.support.test.runner.AndroidJUnitRunner",
            "runner"                       : "com.android.support.test:runner:1.0.1",
            "espresso-core"                : "com.android.support.test.espresso:espresso-core:${version["espressoSdkVersion"]}",
            "espresso-contrib"             : "com.android.support.test.espresso:espresso-contrib:${version["espressoSdkVersion"]}",
            "espresso-intents"             : "com.android.support.test.espresso:espresso-intents:${version["espressoSdkVersion"]}",
            "mockito-core"                 : "org.mockito:mockito-core:1.+",
            "timber"                       : "com.jakewharton.timber:timber:4.7.0",
            "logger"                       : "com.orhanobut:logger:2.2.0",
            "canary-debug"                 : "com.squareup.leakcanary:leakcanary-android:${version["canarySdkVersion"]}",
            "canary-release"               : "com.squareup.leakcanary:leakcanary-android-no-op:${version["canarySdkVersion"]}",
            "umeng-analytics"              : "com.umeng.analytics:analytics:6.0.1",

            "constraint-layout"            : "com.android.support.constraint:constraint-layout:${version["constraintVersion"]}",

            "eventBus"                     : "org.greenrobot:eventbus:${version["eventBusVersion"]}",

            "realtimeblurview"             : "com.github.mmin18:realtimeblurview:1.0.6",
            "circleimageview"              : "de.hdodenhof:circleimageview:2.1.0",
            "loadinglayout"                : "com.github.czy1121:loadinglayout:1.0.1",
            "BaseRecyclerViewAdapterHelper": "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.40",
            "banner"                       : "com.youth.banner:banner:1.4.9",
    ]
}

config_conponent.gradle

if (isBuildModule.toBoolean()) {
    apply plugin: 'com.android.application'
} else {
    apply plugin: 'com.android.library'
}
apply plugin: 'com.alibaba.arouter'
apply plugin: 'com.jakewharton.butterknife'

Properties properties = new Properties()
// local.properties file in the root director
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def BILIBILI_APPKEY = properties.getProperty('BILIBILI_APPKEY')
def ali_feedback_key = properties.getProperty('ali_feedback_key')
def ali_feedback_key_secret = properties.getProperty('ali_feedback_key_secret')

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    useLibrary 'org.apache.http.legacy'

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
        buildConfigField "String", "BILIBILI_APPKEY", "\"" + BILIBILI_APPKEY + "\""
        buildConfigField "String", "ali_feedback_key", "\"" + ali_feedback_key + "\""
        buildConfigField "String", "ali_feedback_key_secret", "\"" + ali_feedback_key_secret + "\""
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [moduleName: project.getName()]
                includeCompileClasspath true
            }
        }
    }
    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            buildConfigField "boolean", "IS_BUILD_MODULE", "${isBuildModule}"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            buildConfigField "boolean", "IS_BUILD_MODULE", "${isBuildModule}"
            minifyEnabled true
            if (isBuildModule.toBoolean()) {
                shrinkResources true
            }
            useProguard true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'InvalidPackage'
        disable "ResourceType"
        abortOnError false
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
            if (isBuildModule.toBoolean()) {
                manifest.srcFile 'src/main/debug/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/release/AndroidManifest.xml'
            }
        }
    }
}

dependencies {
    if (isBuildModule.toBoolean()) {
        //view
        annotationProcessor(rootProject.ext.dependencies["butterknife-compiler"]) {
            exclude module: 'support-annotations'
        }
        //tools
        annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
        annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
        //test
        debugImplementation rootProject.ext.dependencies["canary-debug"]
        releaseImplementation rootProject.ext.dependencies["canary-release"]
        testImplementation rootProject.ext.dependencies["canary-release"]
    } else {
        compileOnly rootProject.ext.dependencies["butterknife-compiler"]
        compileOnly rootProject.ext.dependencies["dagger2-compiler"]
        compileOnly rootProject.ext.dependencies["arouter-compiler"]
        compileOnly rootProject.ext.dependencies["canary-debug"]
        compileOnly rootProject.ext.dependencies["canary-release"]
    }
}

CommonSDK 的 build.gradle

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.alibaba.arouter'
Properties properties = new Properties()
// local.properties file in the root director
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def BILIBILI_APPKEY = properties.getProperty('BILIBILI_APPKEY')

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]

        buildConfigField "String", "BILIBILI_APPKEY", "\"" + BILIBILI_APPKEY + "\""

        testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
    }

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            buildConfigField "String", "BILIBILI_APPKEY", "\"" + BILIBILI_APPKEY + "\""

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            buildConfigField "String", "BILIBILI_APPKEY", "\"" + BILIBILI_APPKEY + "\""

            minifyEnabled false
            useProguard true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:design:${supportVersion}"
    api project(':component:CommonArms')
    api project(':widgets:widget-messagelist')
    api project(':widgets:widget-chatinput')

    //epub
    api('nl.siegmann.epublib:epublib-core:3.1') {
        exclude group: 'xmlpull'
    }
    //RxBus
    api 'com.hwangjr.rxbus:rxbus:2.0.0'

    //J_SOUP
    api 'org.jsoup:jsoup:1.11.3'
    api 'cn.wanghaomiao:JsoupXpath:2.2'
    api 'com.jayway.jsonpath:json-path:2.4.0'
    api 'io.apisense:rhino-android:1.0'
    //字符串比较
    api 'net.ricecode:string-similarity:1.0.0'
    // device
    api 'com.jaredrummler:android-device-names:1.1.5'
    // loader
    api 'com.billy.android:pre-loader:2.0.1'
    // 工具类
    api 'com.blankj:utilcode:1.17.0'
    // Time and date handling
    api 'joda-time:joda-time:2.9.9'
    //tools
    api 'pub.devrel:easypermissions:1.3.0'
    // 键值对存储 key-value
    api 'com.tencent:mmkv:1.0.16'
    // ormlite
    api 'com.j256.ormlite:ormlite-android:4.45'
    //Okhttp3
    api 'com.squareup.okhttp3:okhttp:3.10.0'
    api 'com.squareup.okhttp3:logging-interceptor:3.10.0'
    //Retrofit2
    api "com.squareup.retrofit2:adapter-rxjava:${retrofit}"
    api "com.squareup.retrofit2:converter-gson:${retrofit}"
    api "com.squareup.retrofit2:retrofit:${retrofit}"
    api rootProject.ext.dependencies["retrofit-url-manager"]
    api(rootProject.ext.dependencies["arouter"]) {
        exclude module: 'support-v4'
        exclude module: 'support-annotations'
    }
    api(rootProject.ext.dependencies["glide"]) {
        exclude module: 'support-v4'
    }
    annotationProcessor(rootProject.ext.dependencies["glide-compiler"]) {
        exclude module: 'jsr305'
    }

    //region third party
    api project(":component:lib")
    api files('libs/ocr-sdk.jar')
    api files('libs/androidasync-2.1.6.jar')
    api files('libs/BmobSDK_3.6.5.jar')
    api files('libs/AndroidScreenCap.jar')
    api files('libs/securityguard-3.1.27.jar')
    api files('libs/Msc.jar')
    api files('libs/Sunflower.jar')
//    api files('libs/BmobNewIM_2.1.1.jar')
//    api files('libs/juniversalchardet-1.0.3.jar')

    // 阿里百川用户反馈
    api 'com.aliyun.ams:alicloud-android-feedback:3.1.0@aar'
    api 'com.aliyun.ams:alicloud-android-utdid:1.1.5.3'
    api 'com.aliyun.ams:alicloud-android-ut:5.1.0'
    api 'com.aliyun.ams:alicloud-android-utils:1.0.3'
    //腾讯 bugly
    api 'com.tencent.bugly:crashreport:2.6.6.1' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
    api 'com.tencent.bugly:nativecrashreport:3.3.1' //其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0

    //endregion
}

CommonRes 的 build.gradle

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.alibaba.arouter'
android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]

        testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            useProguard true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        disable 'MissingTranslation'
    }
//    resourcePrefix "public_" //给 Module 内的资源名增加前缀, 避免资源名冲突
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    api project(":component:CommonData") //因为 CommonRes 依赖了 CommonSDK, 所以如果业务模块需要公共 UI 组件就依赖 CommonRes, 如果不需要就只依赖 CommonSDK
    api project(':widgets:widget-colorpicker')
    api project(':widgets:widget-messagelist')
    api project(':widgets:widget-chatinput')
    api project(':widgets:widget-calendar')

    api(rootProject.ext.dependencies["cardview-v7"]) {
            exclude module: 'support-annotations'
    }
    api "com.android.support:appcompat-v7:${supportVersion}"
    api "com.android.support:cardview-v7:${supportVersion}"
    api "com.android.support.constraint:constraint-layout:1.1.3"
//    api 'androidx.constraintlayout:constraintlayout:1.1.3'
//    api 'androidx.appcompat:appcompat:1.0.0-alpha1'
    api rootProject.ext.dependencies["paginate"]
    api rootProject.ext.dependencies["lottie"]
    api rootProject.ext.dependencies["loadinglayout"]
    api rootProject.ext.dependencies["realtimeblurview"]
    api rootProject.ext.dependencies["circleimageview"]
    api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
    api rootProject.ext.dependencies["banner"]

    //region UI
    api 'com.github.iwgang:countdownview:2.1.6'
//    api 'com.github.takusemba:spotlight:1.7.0'

    api 'com.github.Bakumon:StatusLayoutManager:1.0.4'

    api 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
    //recyclerview
    api 'com.yanzhenjie:recyclerview-swipe:1.0.2'
    api 'jp.wasabeef:recyclerview-animators:2.2.6'
    // ExpansionPanel
    api 'com.github.florent37:expansionpanel:1.0.7'
    //floating action button
    api 'com.getbase:floatingactionbutton:1.9.0'
    // round image view(for material getDrawer)
    api 'com.makeramen:roundedimageview:2.3.0'
    api 'com.jaredrummler:animated-svg-view:1.0.5'
    api 'com.flyco.roundview:FlycoRoundView_Lib:1.1.4@aar'
    api 'eu.davidea:flipview:1.1.3'
    // material
    api 'com.github.rey5137:material:1.2.4'
    // material dialog
    // time picker
    api 'com.contrarywind:Android-PickerView:4.1.2'
    // navigationBar
    api 'me.majiajie:pager-bottom-tab-strip:2.2.5'
    // material getDrawer
    api('com.mikepenz:materialdrawer:6.0.3@aar') { transitive = true }
    api 'com.mikepenz:iconics-core:2.1.0@aar'
    api 'com.mikepenz:google-material-typeface:2.1.2.1@aar'
    api 'com.mikepenz:community-material-typeface:1.2.65.1@aar'
    api 'com.mikepenz:fontawesome-typeface:4.7.0.2@aar'
    api('com.mikepenz:materialize:0.2.7@aar') { transitive = true }
//    api 'me.drakeet.multitype:multitype:3.4.4'
//    api ('com.mikepenz:aboutlibraries:5.2.5@aar') { transitive = true }
    // refresh recycle view
    api 'de.hdodenhof:circleimageview:2.2.0'
    //图表
    api 'com.github.lecho:hellocharts-library:1.5.8@aar'
    //calendar
    api('com.github.applikeysolutions:cosmocalendar:1.0.4')
    //progress bar
    api 'com.akexorcist:RoundCornerProgressBar:2.0.3'
    //多选
    api 'com.hyman:flowlayout-lib:1.1.2'
    api 'com.github.jaouan:compoundlayout:1.0.1'
    api 'com.github.XunMengWinter:CircularAnim:0.4.1'
    //web
    api 'com.just.agentweb:agentweb:4.0.2' // (必选)
    api 'com.just.agentweb:download:4.0.2' // (可选)
    api 'com.just.agentweb:filechooser:4.0.2'// (可选)

    // 状态栏透明
    api 'com.yanzhenjie:sofia:1.0.5'
    // 声音
    api 'com.google.android.exoplayer:exoplayer-core:2.6.0'
    //endregion

    api 'com.haibin:calendarview:3.2.7'
    api 'com.qmuiteam:qmui:1.1.2'
    api 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.5-alpha-2'
    api 'pl.droidsonroids.gif:android-gif-drawable:1.2.14'
//    api 'com.github.xuxiaoxingxing:gifloadingview:1.0.6'
    api 'eu.davidea:flexible-adapter:5.0.4'
    api 'eu.davidea:flexible-adapter-ui:1.0.0-b4'
    api 'com.mikepenz:iconics-core:2.1.0@aar'
    api 'com.jaredrummler:animated-svg-view:1.0.5'
    api 'com.rengwuxian.materialedittext:library:2.0.3'
    api 'com.afollestad.material-dialogs:commons:0.9.6.0'
    // bottomsheet
    api 'com.flipboard:bottomsheet-core:1.5.3'
    api 'com.flipboard:bottomsheet-commons:1.5.3'
    // anim
    api 'com.daimajia.easing:library:2.1@aar'
    api 'com.daimajia.androidanimations:library:2.3@aar'
    //布局
    api 'org.apmem.tools:layouts:1.10@aar'
    // Time and date handling
    api 'joda-time:joda-time:2.9.9'
    // state
    api "com.evernote:android-state:${state_version}"
    // ormlite
    api 'commons-io:commons-io:2.6'
    //endregion

    //region UI
    // material dialog
    api 'com.afollestad.material-dialogs:commons:0.9.6.0'
    // toast
    api 'com.github.GrenderG:Toasty:1.1.3'
    // snackbar
    api 'com.nispok:snackbar:2.9.0'
    // adapter
    api 'eu.davidea:flexible-adapter:5.0.4'
    api 'eu.davidea:flexible-adapter-ui:1.0.0-b4'
    api 'com.github.LinXueyuanStdio:holdbutton:1.0.6'
    //endregion

    //region 代码
    api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // mvp 框架
    api "net.grandcentrix.thirtyinch:thirtyinch:${thirtyinchVersion}"
    api "net.grandcentrix.thirtyinch:thirtyinch-rx2:${thirtyinchVersion}"
    //RxLifecycle
    api 'com.trello:rxlifecycle-components:0.6.1'
    // Event bus
    api 'org.greenrobot:eventbus:3.1.1'
    // Because RxAndroid releases are few and far between, it is recommended you also
    // explicitly depend on RxJava's latest version for bug fixes and new features.
    api 'io.reactivex:rxandroid:1.2.1'
    api 'io.reactivex.rxjava2:rxandroid:2.0.2'
    api 'io.reactivex:rxjava:1.3.2'
    api 'io.reactivex.rxjava2:rxjava:2.1.12'
    // fragment 框架
    api 'me.yokeyword:fragmentation-core:1.3.6'
    // To simplify the communication between Fragments.
    api 'me.yokeyword:eventbus-activity-scope:1.1.0'
    // folding cell
    api 'com.ramotion.foldingcell:folding-cell:1.2.1'
    // navigation tab bar
    api 'devlight.io:navigationtabbar:1.2.5'
    // view pager
    api 'com.github.devlight:infinitecycleviewpager:1.0.2'
    // loading button
    api 'br.com.simplepass:loading-button-android:1.14.0'
    // overlay permission
    api 'com.github.czy1121:settingscompat:1.1.4'
    //endregion

    api 'com.zhangmonke:MProgressBar:1.0.1'
    api 'me.grantland:autofittextview:0.2.1'
    api 'com.victor:lib:1.0.4'

    //换肤
//    api 'skin.support:skin-support:3.1.1'                   // skin-support 基础控件支持
//    api 'skin.support:skin-support-design:3.1.1'            // skin-support-design material design 控件支持[可选]
//    api 'skin.support:skin-support-cardview:3.1.1'          // skin-support-cardview CardView 控件支持[可选]
//    api 'skin.support:skin-support-constraint-layout:3.1.1' // skin-support-constraint-layout ConstraintLayout 控件支持[可选]
}
LinXueyuanStdio commented 5 years ago

14bccb1b-3716-42fd-9508-8a783054cecd png b301c102-43ee-496c-bada-d15f4db8eb09 png

LinXueyuanStdio commented 5 years ago

个人项目,老司机快来带带我😭嘤嘤嘤

JessYanCoding commented 5 years ago

你这项目有点大,试试将 Module 打包成 AAR,可以减少编译时间

LinXueyuanStdio commented 5 years ago

@JessYanCoding 我尝试着打包成AAR了,但是编译时间并没有减少,甚至还增加了。。。现在全部编译一次的时间是2个小时。。。时间都花在transform上了。

然后我尝试着深度组件化(反正总的时间不可能减少了,因为代码行数有20w+),参考了wiki和demo,但是实践中发现demo的方法有很大的问题,尤其是CommonRes和CommonSDK,简直垃圾堆。所以最后我自己通过思考确立了一系列规范,做到了组件间绝对独立,调试和发布组件的切换不需要Sync,节省大量时间,单个组件4w+行代码现在全量编译15min,增量编译1min,可以接受。

我边组件化边编写了几万字的组件化规范文档,记录了实践过程中的问题和思考,以及最优雅的解决方案。现在组件化就是按着规范把老代码无脑复制粘贴了,贼爽!

JessYanCoding commented 5 years ago

@LinXueyuanStdio 很棒👍,在实践中积累的经验是最有价值的,即然在这里面踩了这么多坑,可以写一篇文章分享出来你的经验,以帮助更多的人,传播开源的精神

LinXueyuanStdio commented 5 years ago

@JessYanCoding 好哒~写好demo就发!

JessYanCoding commented 5 years ago

好的,到时候写好后,可以贴到这里来

LinXueyuanStdio commented 5 years ago

@JessYanCoding

咕咕咕

突然发现原记录里很多细节没到位,就去补充了很多细节。所以,嗯,文章写了,demo没写......

用生命周期规范组件化流程

LinXueyuanStdio commented 5 years ago

同时也发到掘金上了:https://juejin.im/post/5c82971f5188257e5e298ebe

JessYanCoding commented 5 years ago

写的很用心,很详细,先 star,空了慢慢看

JessYanCoding commented 5 years ago

小伙子,很不错,还是大学生就这么优秀了,期待你的 demo