build.gradle
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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"
        }
    }
}