18034727885
2026-07-17 2b48ea4a877abe6cc7b50e20d1b3c70b7fd08d5a
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
 
android {
    compileSdkVersion 35
    buildToolsVersion "33.0.3"
    namespace "com.driver.igotrip"
    packagingOptions {
        jniLibs {
            useLegacyPackaging true
        }
        exclude 'META-INF/*'
        exclude 'META-INF/NOTICE' // will not include NOTICE file
        exclude 'META-INF/LICENSE' // will not include LICENSE file
        exclude 'META-INF/INDEX.LIST' // will not include INDEX.LIST file
    }
 
    signingConfigs {
        config {
            keyAlias 'igotrip'
            keyPassword 'igotrip'
            storeFile file('igotrip.jks')
            storePassword 'igotrip'
        }
    }
 
    defaultConfig {
        applicationId "com.driver.goposttrip"
        minSdkVersion 23
        targetSdkVersion 35
        versionCode 49
        versionName "1.7.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 
        manifestPlaceholders = [
                JPUSH_PKGNAME : applicationId,
                JPUSH_APPKEY : "1e5708b2168543a15bfb72ef", //JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
                MAPS_API_KEY: "AIzaSyBOlo_xsCKz78o1B869fvRfasSX3B4okEU"  // 替换为实际的API Key
        ]
    }
    //别名 okTripDriver 密码 111111
 
    buildTypes {
        release {
            minifyEnabled false
            zipAlignEnabled true
            signingConfig signingConfigs.config
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            zipAlignEnabled true
            signingConfig signingConfigs.config
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
 
    compileOptions {
        // Flag to enable support for the new language APIs
        coreLibraryDesugaringEnabled true
        // Sets Java compatibility to Java 8
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"  // 与上面保持一致
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
 
// 关键:添加分辨率策略,强制优先使用 play-services-maps 的类
    configurations.all {
        resolutionStrategy {
            // 强制所有依赖中,com.google.android.gms:play-services-maps 优先使用 18.0.2 版本
            force 'com.google.android.gms:play-services-maps:18.0.2'
            // 强制地图模型类优先使用 play-services-maps-model:18.0.2
            force 'com.google.android.gms:play-services-maps-model:18.0.2'
        }
    }
// 关键1:过滤 navigation 中重复的地图类文件(核心去重)
    packagingOptions {
        // 排除 navigation 中 com/google/android/gms/maps 包下的所有类文件
        exclude 'com/google/android/gms/maps/**/*.class'
        exclude 'com/google/android/gms/maps/model/**/*.class'
        exclude 'com/google/android/gms/maps/internal/**/*.class'
        // 排除重复的资源文件(若有)
        exclude 'com/google/android/gms/maps/mapbox/**/*.png'
        exclude 'com/google/android/gms/maps/mapbox/**/*.xml'
    }
 
    buildFeatures {
        buildConfig = true  // 显式启用 BuildConfig
    }
 
}
// 在文件末尾添加
afterEvaluate {
    android.applicationVariants.all { variant ->
        def variantName = variant.name
        // 找到对应变体的bundle任务
        def bundleTask = tasks.findByName("bundle${variantName.capitalize()}")
        if (bundleTask != null) {
            bundleTask.doLast {
                // 输出目录
                def outputDir = file("${rootDir}/app/${variantName}/")
                if (outputDir.exists()) {
                    outputDir.listFiles().each { file ->
                        if (file.name.endsWith('.aab')) {
                            // 获取当前时间戳
                            def timestamp = new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+08"))
 
                            // 构建新的文件名
                            def newName = file.name.replace("app-${variantName}", "GoPost-driver-${variant.versionName}-${variant.buildType.name}-${timestamp}")
 
                            // 重命名文件
                            def newFile = new File(file.parentFile, newName)
 
                            if (file.renameTo(newFile)) {
                                println "✅ 文件重命名成功: ${file.name} -> ${newFile.name}"
                                println "📁 文件路径: ${newFile.absolutePath}"
                            } else {
                                println "❌ 文件重命名失败: ${file.name}"
                            }
                        }
                    }
                } else {
                    println "⚠️ 目录不存在: ${outputDir.absolutePath}"
                }
            }
        }
        // 找到对应变体的package任务
        def packageTask = tasks.findByName("package${variantName.capitalize()}")
        if (packageTask != null) {
            packageTask.doLast {
                // 输出目录
                def outputDir = file("${rootDir}/app/${variantName}/")
                if (outputDir.exists()) {
                    outputDir.listFiles().each { file ->
                        if (file.name.endsWith('.apk')) {
                            // 获取当前时间戳
                            def timestamp = new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+08"))
 
                            // 构建新的文件名
                            def newName = file.name.replace("app-${variantName}", "GoPost-driver-${variant.versionName}-${variant.buildType.name}-${timestamp}")
 
                            // 重命名文件
                            def newFile = new File(file.parentFile, newName)
 
                            if (file.renameTo(newFile)) {
                                println "✅ 文件重命名成功: ${file.name} -> ${newFile.name}"
                                println "📁 文件路径: ${newFile.absolutePath}"
                            } else {
                                println "❌ 文件重命名失败: ${file.name}"
                            }
                        }
                    }
                } else {
                    println "⚠️ 目录不存在: ${outputDir.absolutePath}"
                }
            }
        }
    }
}
 
repositories {
    flatDir {
        dirs 'libs'
    }
}
// 强制统一 play-services-maps 版本
configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-maps:18.0.2'
    }
}
 
dependencies {
    implementation 'androidx.activity:activity-ktx:1.8.0'
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    implementation "com.facebook.soloader:soloader:0.12.1"
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.0"
    implementation 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.34'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.activity:activity:1.8.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation project(path: ':xldUtils')
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.mobsandgeeks:android-saripaar:2.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.github.zackratos.ultimatebar:ultimatebar3:3.1.1'
 
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.github.xuexiangjys:XUI:1.1.3'
    implementation 'pub.devrel:easypermissions:1.3.0'
    implementation 'liji.library.dev:citypickerview:5.2.1'
    implementation 'com.ypx.yimagepicker:androidx:3.1.4'
    implementation project(path: ':rxnetty')
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.google.zxing:core:3.3.0'
//    implementation 'cn.jiguang.sdk:jpush:6.0.2'  // 此处以JPush 3.6.6 版本为例。
//    implementation 'cn.jiguang.sdk:jcore:5.3.1'  // 此处以JCore 2.3.8 版本为例。
//    implementation 'com.tencent.bugly:crashreport:latest.release'
//    implementation ('com.google.android.gms:play-services-maps:18.0.2')
//    {
//        exclude group: 'com.google.android.gms.maps.CameraUpdate', module: 'play-services-basement'
//    }
//    implementation 'com.google.android.libraries.places:places:2.6.0'
    implementation 'com.facebook.android:facebook-share:12.2.0' //脸书分享
    implementation 'com.twitter.sdk.android:twitter:3.1.1'
 
    //implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
   // implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:6.0.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.3'
 
 
    implementation 'com.google.auth:google-auth-library-oauth2-http:1.19.0'
    implementation 'com.google.cloud:google-cloud-texttospeech:2.46.0'
 
    // 保留单独的地图库
  //  implementation 'com.google.android.gms:play-services-maps:18.0.2'
    // 导航相关依赖
    implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
    implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:6.0.0'
 
 
    //implementation ('com.google.android.gms:play-services-maps:18.0.2')
    // 导航SDK(核心依赖)
   // implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
    // 可选:导航语音播报依赖
   // implementation 'com.google.android.libraries.navigation:navigation-voice:6.0.0'
 
    // 可选:定位服务(如需显示用户位置)
  //  implementation 'com.google.android.gms:play-services-location:21.0.1'
 
    // 2. 导航SDK核心依赖(关键!之前可能只加了这行,缺少其他)
   /* implementation ('com.google.android.gms:play-services-maps:18.0.2')
    {
        // 排除 com.google.android.gms.maps 包下的所有类(覆盖所有重复类)
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
        // 额外排除内置的重复地图模型类(兜底,避免漏网之鱼)
        exclude group: 'com.google.android.gms', module: 'play-services-maps-model'
    }
    implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
    implementation 'com.google.android.libraries.mapsplatform.transportation:transportation-driver:6.0.0'*/
    // 4. 可选:导航语音播报(如果需要语音引导)
   // implementation 'com.google.android.libraries.navigation:navigation-voice:6.1.0'
 
 
    //cameraX
    implementation "androidx.camera:camera-core:1.4.2"
    implementation "androidx.camera:camera-camera2:1.4.2"
    implementation "androidx.camera:camera-lifecycle:1.4.2"
    implementation "androidx.camera:camera-view:1.4.2"
 
    implementation 'top.zibin:Luban:1.1.8'
 
 
    implementation project(path: ':easyfloat')
 
    //友盟
//    implementation 'com.umeng.umsdk:share-core:7.3.7'
//    implementation 'com.umeng.umsdk:common:9.8.9'//必选
//    implementation 'com.umeng.umsdk:asms:1.8.7.2' //必选
    //微信
//    implementation 'com.umeng.umsdk:share-wx:7.3.7'
}