/* * @Author: XianKaiQun * @Date: 2020-03-31 18:07:43 * @LastEditors : WuWei * @LastEditTime : 2023-05-17 09:38:41 * @Descripttion: */ //读取打包证书 def keystorePropertiesFile = rootProject.file("cert/key.properties") def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) //读取local.properties def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') // if (flutterRoot == null) { // throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") // } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 35 //flutter.compileSdkVersion ndkVersion "27.0.12077973" sourceSets { main.java.srcDirs += 'src/main/kotlin' } //多渠道打包 flavorDimensions "type" productFlavors{ dev{ dimension "type" applicationId "cn.huifuwu.appdev" manifestPlaceholders = [ APP_NAME: "绘服务dev", //高德 // AMAP_KEY : "ceca571ebb034cfa994cc772dace12cc", ] } prod{ dimension "type" applicationId "cn.huifuwu.app" manifestPlaceholders = [ APP_NAME: "绘服务", //高德 // AMAP_KEY : "8a246a9e2a9f110609d2e13524948fec", ] } } defaultConfig { minSdk 27 targetSdk 35 // 使用自带的sdk版本 //flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" //multiDexEnabled true ////报dex超过64k时需要 } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" } //配置打包证书 signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release } debug { minifyEnabled true signingConfig signingConfigs.release } profile { signingConfig signingConfigs.release } } namespace 'cn.huifuwu.app' // buildToolsVersion '36.0.0 rc5' } flutter { source '../..' } dependencies { // 此处以JPush 5.6.0 版本为例,注意:从 5.0.0 版本开始可以自动拉取 JCore 包,无需另外配置 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' // implementation 'com.android.support:multidex:1.0.1' //报dex超过64k时需要 //引入高德地图SDK 已去除 // implementation('com.amap.api:3dmap:7.7.0') // implementation('com.amap.api:location:5.2.0') }