| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- plugins {
- alias(libs.plugins.android.application)
- alias(libs.plugins.kotlin.android)
- alias(libs.plugins.kotlin.compose)
- }
- android {
- namespace 'com.narutohuo.xindazhou'
- compileSdk {
- version = release(36)
- }
- // 从资源文件读取配置值(用于 manifestPlaceholders)
- // 这样所有配置都在 strings.xml 中,build.gradle 只是读取并设置占位符
- def getStringResource = { String name ->
- def resFile = file("src/main/res/values/strings.xml")
- if (!resFile.exists()) {
- return ""
- }
- def xml = new XmlParser().parse(resFile)
- def stringNode = xml.string.find { it.@name == name }
- return stringNode ? stringNode.text() : ""
- }
- defaultConfig {
- applicationId "com.narutohuo.xindazhou"
- minSdk 26
- targetSdk 36
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- // SDK 占位符配置(从资源文件读取,所有值都在 strings.xml 中)
- // 这样用户只需要在 strings.xml 中配置一次,不需要在 AndroidManifest.xml 中手动填写
-
- // QQ scheme 处理:优先使用 qq_app_id_scheme,如果没有则使用 qq_app_id 拼接
- def qqAppIdScheme = getStringResource("qq_app_id_scheme")
- def qqAppId = getStringResource("qq_app_id")
- def qqScheme = ""
- if (qqAppIdScheme && !qqAppIdScheme.contains("your_qq_appid_here")) {
- qqScheme = qqAppIdScheme
- } else if (qqAppId && !qqAppId.contains("your_qq_appid_here")) {
- qqScheme = "tencent" + qqAppId
- } else {
- qqScheme = "tencentyour_qq_appid_here"
- }
-
- manifestPlaceholders = [
- JPUSH_APPKEY: getStringResource("jpush_app_key") ?: "your_jpush_appkey_here",
- JPUSH_CHANNEL: getStringResource("push_jpush_channel") ?: "developer-default",
- // QQ scheme 格式:tencent + qq_app_id(例如:tencent1101234567)
- qqappid: qqScheme
- ]
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_17
- }
- kotlinOptions {
- jvmTarget = '17'
- }
- buildFeatures {
- compose true
- viewBinding true
- buildConfig true // 启用 BuildConfig 生成
- }
- }
- dependencies {
- // 基础模块
- implementation project(':base-core')
- implementation project(':base-common')
-
- // SDK模块(能力层)
- implementation project(':capability-ble')
- implementation project(':capability-socketio')
- implementation project(':capability-push')
- implementation project(':capability-qrcode')
- implementation project(':capability-share')
- implementation project(':capability-nfc')
-
- // 友盟分享需要的第三方平台 SDK(确保运行时能找到)
- // 注意:友盟分享模块已经添加了这些依赖,但为了确保运行时能找到,也在 app 模块中添加
- implementation("com.tencent.mm.opensdk:wechat-sdk-android:6.8.24")
-
- // 业务模块代码已迁移到 app 模块内,不再需要独立的 module-* 依赖
-
- // AndroidX Core
- implementation libs.androidx.core.ktx
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'com.google.android.material:material:1.11.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- implementation 'androidx.cardview:cardview:1.0.0'
-
- // ViewModel & LiveData & StateFlow
- implementation libs.androidx.lifecycle.runtime.ktx
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
- implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
-
- // Kotlin Coroutines
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
-
- // Navigation
- implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
- implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'
-
- // Timber (日志库,用于Hyperion)
- implementation 'com.jakewharton.timber:timber:5.0.1'
-
- // Retrofit & OkHttp
- implementation 'com.squareup.retrofit2:retrofit:2.9.0'
- implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
- implementation 'com.squareup.okhttp3:okhttp:4.12.0'
- implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
-
- // Glide
- implementation 'com.github.bumptech.glide:glide:4.16.0'
-
- // Room
- implementation 'androidx.room:room-runtime:2.6.1'
- implementation 'androidx.room:room-ktx:2.6.1'
- annotationProcessor 'androidx.room:room-compiler:2.6.1'
-
- // Compose
- implementation libs.androidx.activity.compose
- implementation platform(libs.androidx.compose.bom)
- implementation libs.androidx.compose.ui
- implementation libs.androidx.compose.ui.graphics
- implementation libs.androidx.compose.ui.tooling.preview
- implementation libs.androidx.compose.material3
-
- // 调试工具(只在Debug版本使用)
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-core:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-attr:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-measurement:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-disk:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-recorder:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-phoenix:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-crash:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-shared-preferences:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-geiger-counter:0.9.34'
- debugImplementation 'com.willowtreeapps.hyperion:hyperion-timber:0.9.34' // 日志查看
-
- // Chuck - 网络请求调试(只在Debug版本使用)
- debugImplementation 'com.github.chuckerteam.chucker:library:4.0.0'
- releaseImplementation 'com.github.chuckerteam.chucker:library-no-op:4.0.0'
-
- // Testing
- testImplementation libs.junit
- androidTestImplementation libs.androidx.junit
- androidTestImplementation libs.androidx.espresso.core
- androidTestImplementation platform(libs.androidx.compose.bom)
- androidTestImplementation libs.androidx.compose.ui.test.junit4
- debugImplementation libs.androidx.compose.ui.tooling
- debugImplementation libs.androidx.compose.ui.test.manifest
- }
|