build.gradle 2.61 KB
plugins {
    id 'com.android.application'
}

android {
    namespace 'com.ectrip.checkincar'
    compileSdk 34

    defaultConfig {
        applicationId "com.ectrip.checkincar"
        minSdk 23
        targetSdk 34
        versionCode 1
        versionName "1.0.0"

        ndk {
            abiFilters 'arm64-v8a', 'armeabi-v7a'
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            jniDebuggable true
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildFeatures {
        viewBinding true
    }

    packaging {
        jniLibs {
            // 百度 SDK 的 .so 预编译且含有效 hash 段,禁止 Gradle strip 破坏 ELF 结构
            doNotStrip '**/*.so'
            // 使用传统打包方式,保证 .so 原样存入 APK 不被修改
            useLegacyPackaging = true
        }
        resources {
            excludes += [
                    'META-INF/DEPENDENCIES',
                    'META-INF/LICENSE',
                    'META-INF/LICENSE.txt',
                    'META-INF/license.txt',
                    'META-INF/NOTICE',
                    'META-INF/NOTICE.txt',
                    'META-INF/notice.txt',
                    'META-INF/*.kotlin_module'
            ]
        }
    }
}

// APK 输出文件名前缀改为 checkincar
android.applicationVariants.all { variant ->
    variant.outputs.all { output ->
        String oldName = output.outputFileName
        if (oldName != null && oldName.startsWith("app-")) {
            output.outputFileName = "checkincar" + oldName.substring(3)
        }
    }
}

dependencies {
    // 百度车牌离线 SDK V7.5(jar + assets 模型 + jniLibs/*.so)
    implementation files('libs/libocrgveplate.jar')
    implementation files('libs/bd_unifylicense.jar')
    implementation files('libs/liantian.jar')

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

    // CameraX
    def camerax_version = "1.3.4"
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-view:${camerax_version}"

    // 网络
    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
}