import com.bingce.AndroidSdk import com.bingce.AndroidX import com.bingce.Kotlin import com.bingce.Libs import com.bingce.SurveyorVersionUtils apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-parcelize' android { useLibrary Libs.httpLegacy compileSdk AndroidSdk.compileSdkVersion namespace "com.project.survey" defaultConfig { applicationId "com.shsx.survey" flavorDimensions "versionName" minSdkVersion AndroidSdk.minSdkVersion targetSdkVersion AndroidSdk.targetSdkVersion def versionUtils = new SurveyorVersionUtils(project) versionCode versionUtils.versionCode + 0 versionName versionUtils.versionName ndk {} testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true buildConfigField "String", "BASE_URL", "\"http://10.190.183.37/\"" javaCompileOptions { annotationProcessorOptions { arguments = [ //数据库room "room.schemaLocation": "$projectDir/src/main/schemas".toString() ] } } } buildFeatures { viewBinding true buildConfig true } productFlavors { shsx { } shsx_test { } } signingConfigs { debug { storeFile file('./debug.keystore') } release { storeFile file(StoreFile) storePassword StorePassword keyAlias KeyAlias keyPassword KeyPassword } } buildTypes { debug { signingConfig signingConfigs.debug minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } splits { // Split apks on build target ABI, view all options for the splits here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits abi { enable true reset() include 'arm64-v8a' //'armeabi-v7a', 'x86'//, 'x86_64', 'mips','armeabi', } } //为了解决部分第三方库重复打包了META-INF的问题 packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'META-INF/*.kotlin_module' exclude '/META-INF/{AL2.0,LGPL2.1}'//适配compose } lintOptions { abortOnError false disable 'GoogleAppIndexingWarning' } applicationVariants.all { variant -> // Apk 输出文件名配置 def versionNameString = variant.productFlavors.get(0).versionName def branch = "_" + ('git rev-parse --short HEAD'.execute().text.trim()) variant.outputs.all { output -> def versionName = (versionName + branch).replace(".", "_") def apkName = output.outputFileName.replace(".apk", "_" + versionName + ".apk") output.outputFileName = apkName //收集mapping文件 def versionUtils = new SurveyorVersionUtils(project) def mappingFolder = versionUtils.mappingFolder if (mappingFolder.isEmpty()) { return } output.assemble.doLast { def mappingFilePath = new File(mappingFolder, apkName.replace(".apk", "") + "_mapping.txt").getAbsolutePath() def defaultMapping = new File(project.projectDir, "mapping.txt") if (defaultMapping.isFile() && defaultMapping.exists()) { if (defaultMapping.renameTo(mappingFilePath)) { System.out.println("生成mapping文件:${mappingFilePath}") } else { System.out.println("生成mapping文件失败") } } } } } } dependencies { implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') implementation AndroidX.Paging.runtime implementation AndroidX.Paging.common implementation AndroidX.Room.runtime implementation AndroidX.Room.ktx implementation AndroidX.Room.paging implementation AndroidX.annotationz implementation AndroidX.appcompat implementation AndroidX.cardView implementation AndroidX.constraintLayout implementation AndroidX.documentFile implementation AndroidX.Ktx.fragment implementation AndroidX.legacyPreference implementation AndroidX.legacySupport implementation AndroidX.Lifecycle.runtimeKt implementation AndroidX.material implementation AndroidX.materialDialogs implementation AndroidX.multidex implementation AndroidX.preference implementation AndroidX.recyclerview implementation Kotlin.corountine implementation Kotlin.sdk implementation Libs.Glide.core implementation Libs.OkHttp.core implementation Libs.OkHttp.loggingInterceptor implementation Libs.Retrofit2.converterFastjson implementation Libs.Retrofit2.core implementation Libs.agentWeb implementation Libs.appUpdate implementation Libs.banner implementation Libs.changeLog implementation Libs.circleImage implementation Libs.compressor implementation Libs.datePicker implementation Libs.downloader implementation Libs.dragExpandGrid implementation Libs.eventBus implementation Libs.fabButton implementation Libs.fileDownloader implementation Libs.flycoTabLayout implementation Libs.giftDrawable implementation Libs.gson implementation Libs.imageTextButton implementation Libs.keyboardVisibility implementation Libs.loadingView implementation Libs.materialAbout implementation Libs.materialEditText implementation Libs.photoView implementation Libs.pickerView implementation Libs.progressBar implementation Libs.recyclerviewAnimator implementation Libs.rootBeer implementation Libs.rubberStamp implementation Libs.scanplus implementation Libs.swipeLayout implementation Libs.tabBar implementation Libs.tencentSonic implementation Libs.threadPoster implementation Libs.timber implementation Libs.unCrop implementation Libs.webChatSdk implementation Libs.xxPermissions implementation project(':colorful') annotationProcessor AndroidX.Room.compiler annotationProcessor Libs.Glide.compiler implementation Libs.LeanCloud.storage // constraints { // implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10") { // because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib") // } // implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10") { // because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib") // } // } testImplementation "junit:junit:4.13.2" androidTestImplementation "androidx.test:runner:1.1.0" androidTestImplementation "androidx.test:rules:1.1.0" androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation "androidx.core:core:1.13.1" implementation "androidx.core:core-ktx:1.13.1" implementation "com.github.zagum:Android-SwitchIcon:1.4.0"//必须的 implementation 'io.github.inflationx:calligraphy3:3.1.1' // implementation 'io.github.inflationx:viewpump:2.0.3' // 沉浸状态栏:https://github.com/gyf-dev/ImmersionBar implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2' // 基础依赖包,必须要依赖 implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2' // kotlin扩展(可选) implementation 'com.github.getActivity:ShapeView:9.2' implementation 'com.sherlockshi.widget:sherlockspinner:1.0.2' implementation 'com.zhy:flowlayout-lib:1.0.3' implementation 'net.sourceforge.jexcelapi:jxl:2.6.12' // 腾讯 MMKV:https://github.com/Tencent/MMKV implementation 'com.tencent:mmkv:1.3.9' // BRVAH https://github.com/CymChad/BaseRecyclerViewAdapterHelper/wiki implementation "io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4" // 上拉刷新下拉加载:https://github.com/scwang90/SmartRefreshLayout implementation 'io.github.scwang90:refresh-layout-kernel:2.0.6' //核心必须依赖 implementation 'io.github.scwang90:refresh-header-material:2.0.6' //谷歌刷新头 // implementation 'io.github.scwang90:refresh-header-classics:2.0.6' //经典刷新头 implementation 'io.github.scwang90:refresh-footer-classics:2.0.6' //经典加载 }