123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- 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 Exception("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"
- import groovy.xml.*
- android {
- compileSdkVersion 32
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- }
- lintOptions {
- disable 'InvalidPackage'
- }
- defaultConfig {
- applicationId "xie.hiyd.com"
- minSdkVersion 21
- targetSdkVersion 31
- versionCode flutterVersionCode.toInteger()
- versionName flutterVersionName
- manifestPlaceholders = [
- TENCENT_APP_ID: "1110701531" ,
- AMAP_KEY: "f606b2f01de83ce2f9984680fa0f1897",
- GETUI_APPID : "Rvnote7osU9Ntxk4tpEP46",
- GETUI_APP_ID : "Rvnote7osU9Ntxk4tpEP46",
- GETUI_APP_KEY : "9bHdNmOfPu5KXKAVKKXUv4",
- GETUI_APP_SECRET: "aMP4ifBDUJAzvL7KUe2M33",
- XIAOMI_APP_ID : "2882303761520111715",
- XIAOMI_APP_KEY : "5722011155715",
- MEIZU_APP_ID : "",
- MEIZU_APP_KEY : "",
- HUAWEI_APP_ID : "",
- OPPO_APP_KEY : "",
- OPPO_APP_SECRET : "",
- VIVO_APP_ID : "",
- VIVO_APP_KEY : ""
- ]
- ndk {
- abiFilters 'armeabi-v7a', 'arm64-v8a'
- }
- }
- signingConfigs {
- debug {
- storeFile file("ojia.keystore")
- storePassword "111111"
- keyAlias "ojia"
- keyPassword "111111"
- }
- release {
- storeFile file("ojia.keystore")
- storePassword "111111"
- keyAlias "ojia"
- keyPassword "111111"
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- zipAlignEnabled true
- shrinkResources false
- // Signing with the debug keys for now, so `flutter run --release` works.
- signingConfig signingConfigs.release
- }
- }
- android.applicationVariants.all { variant ->
- String variantName = variant.name.capitalize()
- println "=====variantName=====$variantName"
- def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
- println "=====task=====$processManifestTask"
- processManifestTask.doFirst { pm ->
- String manifestPath = pm.mainMergedManifest.get().asFile
- println "=====manifestPath=====$manifestPath"
- def xml = pm.mainMergedManifest.get().asFile
- def manifestContent = xml.getText()
- def manifest = new XmlParser().parseText(manifestContent)
- // manifest.declareNamespace('android': 'http://schemas.android.com/apk/res/android')
- def android = new Namespace('http://schemas.android.com/apk/res/android', 'android')
- manifest.application[0].each { component ->
- def hasIntentFilter = false
- component.children().each { child ->
- if(child.name() == "intent-filter"){
- hasIntentFilter = true
- println " =====find $component"
- return true
- }
- }
- if(hasIntentFilter){
- component.attributes().put(android.exported, "true")
- }
- }
- xml.withWriter {out->
- groovy.xml.XmlUtil.serialize(manifest, out)
- }
- }
- variant.outputs.all {
- outputFileName = "qudong_${variant.versionName}_${variant.versionCode}.apk"
- }
- }
- }
- flutter {
- source '../..'
- }
- dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation "androidx.appcompat:appcompat:1.3.1"
- implementation 'com.github.HBiSoft:HBRecorder:2.0.4'
- implementation "com.amap.api:location:6.0.1"
- }
- tasks.withType(JavaCompile) {
- options.encoding = "UTF-8"
- }
|