plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" } def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } android { namespace "com.szls.lszlgl" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } sourceSets { main { jniLibs.srcDirs = ['libs'] } } defaultConfig { applicationId "com.szls.lszlgl" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName // ndk { // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' // } } println "targetSdkVersion: ${flutter.targetSdkVersion}" // 签名配置 signingConfigs { release { v1SigningEnabled true v2SigningEnabled true storeFile file(KEY_PATH) storePassword KEY_PWD keyAlias = ALIAS_NAME keyPassword ALIAS_PWD } } buildTypes { release { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527 minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527 } profile { signingConfig signingConfigs.release shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527 minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527 } debug { signingConfig signingConfigs.release } } android.applicationVariants.all { def buildType = it.buildType.name def flavor = it.productFlavors[0].name def outputFile it.outputs.each { outputFile = it.outputFile // 名称_环境_版本名称_版本号.apk // lszlgl_release_0.0.2_2.apk it.outputFileName = "lszlgl_${flavor}_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk" } } // 多渠道配置 flavorDimensions "default" productFlavors { develop { dimension "default" manifestPlaceholders = [ APP_NAME : "国粮质检-测试", // 极光 注意测试环境的 packagename 和appkey 均不一样 JPUSH_PKGNAME: "com.szls.lszlgl.debug", JPUSH_APPKEY : "2f42e3db4d0083b0bc5a3f6c", JPUSH_CHANNEL: "developer-default" ] applicationIdSuffix ".debug" } product { dimension "default" manifestPlaceholders = [ APP_NAME : "国粮质检", // 极光 注意测试环境的 packagename 和appkey 均不一样 JPUSH_PKGNAME: "com.szls.lszlgl", JPUSH_APPKEY : "???", // 正式环境appkey需要再申请 JPUSH_CHANNEL: "developer-default" ] } } lintOptions { checkReleaseBuilds false abortOnError false } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.amap.api:location:5.6.0' //打印库 implementation files('libs/3.2.2-release.aar') //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊ implementation files('libs/LPAPI-2019-11-20-R.jar') implementation files('libs/image-1.8.4.6.aar') // btp打印机库 implementation files('libs/LabelPrinterJavaSDK.jar') //权限库 implementation 'com.guolindev.permissionx:permissionx:1.7.1' } } flutter { source '../..' }