build.gradle 2.99 KB
apply plugin: 'com.android.application'


def buildTime() {
    def date = new Date()
    def formattedDate = date.format('yyyyMMdd')
    return formattedDate
}


android {
    compileSdkVersion 26
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        applicationId "com.sunvote.xpadapp"

        ndk {
            abiFilters "armeabi-v7a"
            abiFilters "x86"
            abiFilters "armeabi"
            abiFilters "arm64-v8a"
            abiFilters "x86_64"
        }
    }
//    signingConfigs {
//        release {
//            // 此处是相对路径,可以在module app下新建一个key文件夹把keystore文件拷贝进去
//            storeFile file('key/xpad.keystore')
//        }
//        debug {
//            storeFile file('key/debug.keystore')
//        }
//    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

            //Zipalign优化
            zipAlignEnabled true

            // 移除无用的resource文件
//            shrinkResources true

            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    if (output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
                        System.out.println("apk filename${output.outputFile.name}")
                        def apkFile = new File(
                                output.outputFile.getParent(),
                                "通用平板-人大版${variant.flavorName}_v${variant.versionName}_${buildTime()}.apk")
                        output.outputFile.renameTo(apkFile)
                    }
                }
            }
        }
        debug {
            debuggable true
        }
    }
//    externalNativeBuild {
//        cmake {
//            path 'CMakeLists.txt'
//        }
//    }
    productFlavors {
    }

    dexOptions{
        jumboMode true
    }

}

repositories {

    flatDir {
        dirs 'libs'
    }
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.+'
    compile files('libs/ant.jar')
    compile(name: 'ycanfilereadfunc-release', ext: 'aar')
    compile(name: 'ycanreaderfileshow-release', ext: 'aar')
    compile(name: 'ycan-release', ext: 'aar')
    compile project(':statusBar')
    compile 'com.bm.photoview:library:1.4.1'
    compile 'com.github.barteksc:android-pdf-viewer:2.7.0'
    compile 'cn.yipianfengye.android:zxing-library:2.2'
    compile 'com.jaredrummler:android-processes:1.1.1'
}

//#解决某些输入文件使用或覆盖了已过时的 API
allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}