build.gradle 3.87 KB
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"

apply plugin: 'com.huawei.agconnect'

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.naji.one_key"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            //选择要添加的对应 cpu 类型的 .so 库。
            abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
        }

        manifestPlaceholders = [
                JPUSH_PKGNAME : applicationId,
                JPUSH_APPKEY : "27ceb79c44af41ad99202f7a", // NOTE: JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
                HUAWEI_APPID:"101934783",//华为平台注册的appid
                XIAOMI_APPKEY : "5811835841457", // 小米平台注册的appkey
                XIAOMI_APPID : "2882303761518358457", // 小米平台注册的appid
                OPPO_APPKEY : "94d77d10e7bb4c60bcf18a84c8ca8bdd", // OPPO平台注册的appkey
                OPPO_APPID : "30260281", // OPPO平台注册的appid
                OPPO_APPSECRET: "9b7e372f93794593953f93f118619570",//OPPO平台注册的appsecret
//                VIVO_APPKEY : "5811835841457", // VIVO平台注册的appkey
//                VIVO_APPID : "2882303761518358457", // VIVO平台注册的appid
        ]
    }

    signingConfigs {
        release {
            storeFile file("./src/main/assets/xiaotao.jks")
            storePassword "xt123456"
            keyAlias "key0"
            keyPassword "xt123456"
        }

        debug {
            storeFile file("./src/main/assets/xiaotao.jks")
            storePassword "xt123456"
            keyAlias "key0"
            keyPassword "xt123456"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug{
            minifyEnabled false
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    //华为推送
    implementation 'cn.jiguang.sdk.plugin:huawei:3.5.4'
    implementation 'com.huawei.hms:push:3.0.3.301'

    //小米推送
    implementation 'cn.jiguang.sdk.plugin:xiaomi:3.5.4'

//    //OPPO推送
//    implementation 'cn.jiguang.sdk.plugin:oppo:3.4.0'
//
//    //vivo推送
//    implementation 'cn.jiguang.sdk.plugin:vivo:3.5.4'
}