wjc
5 天以前 0fd8faf8061369296b4a92b081d83c940dfc233e
app/build.gradle
@@ -1,6 +1,9 @@
plugins {
    id 'com.android.application'
    // 添加如下配置(华为极光推送)
    id 'com.huawei.agconnect'
}
apply plugin: 'com.google.gms.google-services' // 放在文件底部
//必须配置uni
def mfph = [
        //宿主包名
@@ -8,36 +11,67 @@
]
android {
    namespace 'com.hdl.photovoltaic'
    signingConfigs {
        debug {
            storeFile file('../keystore/Untitled')
            keyAlias 'photovotaic'
            keyAlias 'hdlphotovotaic'
            storePassword '85521566'
            keyPassword '85521566'
        }
        release {
            storeFile file('../keystore/Untitled')
            keyAlias 'photovotaic'
            keyAlias 'hdlphotovotaic'
            storePassword '85521566'
            keyPassword '85521566'
        }
    }
    compileSdk 30
    compileSdk 35
    defaultConfig {
        applicationId "com.hdl.photovoltaic"
        minSdk 23
        targetSdk 30
        versionCode 1
        versionName "1.1.0"
        targetSdk 35
        versionCode 30
        versionName "2.0.0"//版本规则1.3是产品功能迭代用的,最后一位0是我们修复bug用的
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        manifestPlaceholders = mfph
        ndk {
            abiFilters 'x86', 'armeabi-v7a', "arm64-v8a" //不支持armeabi
            abiFilters 'armeabi-v7a', "arm64-v8a" //不支持armeabi
        }
        manifestPlaceholders = [
                JPUSH_PKGNAME: applicationId,
                //JPush 上注册的包名对应的 Appkey.
                JPUSH_APPKEY : "3baee103750e192ba68f3878",
                //暂时填写默认值即可.
                JPUSH_CHANNEL: "developer-default",
//                //若不集成厂商通道,可直接跳过以下配置
//                MEIZU_APPKEY : "MZ-魅族的APPKEY",
//                MEIZU_APPID : "MZ-魅族的APPID",
//                XIAOMI_APPID : "MI-小米的APPID",
//                XIAOMI_APPKEY : "MI-小米的APPKEY",
//                OPPO_APPKEY : "OP-oppo的APPKEY",
//                OPPO_APPID : "OP-oppo的APPID",
//                OPPO_APPSECRET : "OP-oppo的APPSECRET",
//                VIVO_APPKEY : "vivo的APPKEY",
//                VIVO_APPID : "vivo的APPID",
//                HONOR_APPID : "Honor的APP ID",
//                MEIZU_APPKEY : "MZ-魅族的APPKEY",
//                MEIZU_APPID : "110098313",
        ]
    }
//    // 保证其他的lib没有被preDex
//    dexOptions {
//        preDexLibraries = false
//    }
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
    //此处配置必须添加 否则无法正确运行uni
    aaptOptions {
@@ -45,9 +79,16 @@
        //noCompress 'foo', 'bar'
        ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
    }
    repositories {
        flatDir {
            dirs 'libs'
//    lintOptions {
//        checkReleaseBuilds false
//        // Or, if you prefer, you can continue to check for errors in release builds,
//        // but continue the build even when errors are found:
//        abortOnError false
//    }
    packagingOptions {
        jniLibs {
            useLegacyPackaging true
        }
    }
    /**
@@ -55,23 +96,26 @@
     */
    android.applicationVariants.configureEach { variant ->
        variant.outputs.configureEach {
            outputFileName = "photovoltaic_${name}_v${versionName}_${generateTime()}.apk"
            outputFileName = "photovoltaic_v${versionName}_${generateTime()}_${getEnvironmentVersion(4)}.apk"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            minifyEnabled false //开启混淆
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
    buildFeatures {
        viewBinding true
        aidl true
        buildConfig = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
@@ -81,6 +125,20 @@
//构建时间
static def generateTime() {
    return new Date().format("yyyyMMddHHmm")
}
//环境版本号:此版本号用于标注当前版本的软件处于哪个开发阶段,当软件进入到另一个阶段时需要修改此版本号。
static String getEnvironmentVersion(int environmentVersionValue) {
    if (environmentVersionValue == 1) {
        return "dev"//开发阶段版本。(一般不向外部发布,bug会比较多,功能也不全,一般只有开发人员使用。)
    } else if (environmentVersionValue == 2) {
        return "test"//测试阶段版本。(这个阶段版本会配合测试人员修复bug,直到满足发布条件。)
    } else if (environmentVersionValue == 3) {
        return "beta"//公测阶段版本。(公开测试版本,一般是内测通过的,主要会有"粉丝用户"使用体验。)
    } else if (environmentVersionValue == 4) {
        return "release"
//发布阶段版本。(该版本意味"最终版本",在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上。)
    }
}
dependencies {
@@ -93,40 +151,52 @@
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    //时间库
    implementation project(path: ':pickerview')
    //图表库
    implementation project(path: ':aa_chart_core')
    //国家列表和手机区号库
    implementation project(path: ':countrypicker')
    //二维码库
    implementation project(path: ':third-zxing')
    //Link本地库
    implementation project(path: ':HDLLinkLocalSdk')
//    implementation project(path: ':HDLLinkPMSdk')
    //Link本地库(在线依赖网络库)
    implementation 'com.hdl.android:pmsdk:1.0.22'
//    implementation 'com.hdl.android:debugsdk:1.0.71'
    implementation project(path: ':sdk')
    implementation 'androidx.activity:activity:1.2.3'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.hdl.hdlhttp:hxhttp:1.0.4'
    implementation 'com.hdl.hdlhttp:hxhttp:1.0.4'//1.0.4
    //okhttp 打印
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
    //Eventbus事件发布与接收
    implementation 'org.greenrobot:eventbus:3.3.1'
    //屏幕适配
    //屏幕适配库
    implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
    //图片加载库
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    //添加StatusBarUtil的依赖 状态栏适配
    implementation 'com.jaeger.statusbarutil:library:1.5.1'
    //********UniSDK必须添加的依赖 start********
    implementation "androidx.recyclerview:recyclerview:1.0.0"
    implementation 'com.alibaba:fastjson:1.2.66'//必须集成,fastjson功能需要
    implementation 'com.facebook.fresco:fresco:2.5.0'//必须集成,图片加载需要
    implementation 'com.facebook.fresco:animated-gif:2.5.0'//必须集成,图片加载需要
    implementation 'com.facebook.fresco:webpsupport:2.5.0'
    implementation 'com.facebook.fresco:animated-webp:2.5.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'//必须集成,图片加载需要
    implementation 'com.facebook.fresco:fresco:3.6.0'//必须集成,图片加载需要
    implementation 'com.facebook.fresco:animated-gif:3.6.0'//必须集成,图片加载需要
    implementation 'com.facebook.fresco:webpsupport:3.6.0'
    implementation 'com.facebook.fresco:animated-webp:3.6.0'
    implementation 'com.github.bumptech.glide:glide:5.0.5'//必须集成,图片加载需要
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'androidx.webkit:webkit:1.3.0'//3.6.15版本之后 必须集成,用来支持暗黑模式
    implementation 'androidx.webkit:webkit:1.6.1'//3.6.15版本之后 必须集成,用来支持暗黑模式
    //********UniSDK必须添加的依赖 end********
    //NanoHTTPD搭建服务器
    implementation 'org.nanohttpd:nanohttpd:2.3.1'
@@ -135,5 +205,17 @@
    //权限请求框架
    implementation 'com.github.getActivity:XXPermissions:12.8'
    //通用适配器
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.6'
    // //友盟
    // implementation 'com.umeng.umsdk:common:9.5.6'// 必选
    // implementation 'com.umeng.umsdk:asms:1.6.3'// 必选
    // implementation 'com.umeng.umsdk:apm:1.7.0' // 错误分析
    //引入FCM(原生谷歌)
    implementation 'com.google.firebase:firebase-messaging:23.2.1'
    // 使用 ShortcutBadger 库,清除角标
    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
}