apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
//apply plugin: 'monitor-plugin'

android {
    compileSdkVersion 31

    lintOptions {
        abortOnError false
    }

    defaultConfig {
        applicationId 'com.hjq.easy.demo'
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1300
        versionName '13.0'
    }

    // 支持 JDK 1.8
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    // Apk 签名的那些事：https://www.jianshu.com/p/a1f8e5896aa2
    signingConfigs {
        config {
            storeFile file(StoreFile)
            storePassword StorePassword
            keyAlias KeyAlias
            keyPassword KeyPassword
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }

    applicationVariants.configureEach { variant ->
        // apk 输出文件名配置
        variant.outputs.configureEach { output ->
            outputFileName = rootProject.getName() + '.apk'
        }
    }
}

dependencies {
    // 依赖 libs 目录下所有的 jar 和 aar 包
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    
    implementation project(':library')

    // AndroidX 库：https://github.com/androidx/androidx
    implementation 'androidx.appcompat:appcompat:1.4.0'
    // Material 库：https://github.com/material-components/material-components-android
    implementation 'com.google.android.material:material:1.4.0'

    // OkHttp 框架：https://github.com/square/okhttp
    // 升级注意事项：https://www.jianshu.com/p/d12d0f536f55
    // noinspection GradleDependency
    implementation 'com.squareup.okhttp3:okhttp:3.12.13'

    // 吐司框架：https://github.com/getActivity/Toaster
    implementation 'com.github.getActivity:Toaster:12.6'

    // 权限请求框架：https://github.com/getActivity/XXPermissions
    implementation 'com.github.getActivity:XXPermissions:20.0'

    // 标题栏框架：https://github.com/getActivity/TitleBar
    implementation 'com.github.getActivity:TitleBar:10.5'

    // Gson 解析容错：https://github.com/getActivity/GsonFactory
    implementation 'com.github.getActivity:GsonFactory:9.6'
    // Json 解析框架：https://github.com/google/gson
    implementation 'com.google.code.gson:gson:2.10.1'
    // Kotlin 反射库：用于反射 Kotlin data class 类对象
    implementation 'org.jetbrains.kotlin:kotlin-reflect:1.5.10'

    // 腾讯 MMKV：https://github.com/Tencent/MMKV
    implementation ('com.tencent:mmkv-static:1.3.2') {
        // 避免版本不一致导致的依赖冲突，从而导致编译报错
        exclude group: 'androidx.annotation', module: 'annotation'
    }

    // Bugly 异常捕捉：https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20190418140644
    implementation 'com.tencent.bugly:crashreport:4.1.9'
    implementation 'com.tencent.bugly:nativecrashreport:3.9.2'

    // 日志调试框架：https://github.com/getActivity/Logcat
    debugImplementation 'com.github.getActivity:Logcat:11.82'

    // OkHttp 抓包框架：https://github.com/lygttpod/AndroidMonitor
    // debugImplementation 'io.github.lygttpod:monitor:0.0.7'

    // 内存泄漏监测框架：https://github.com/square/leakcanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'
}