android studio gradle区分windows 和mac系统

util.gradle
rootProject.ext.keyStorePath = KeyStorePath()

def KeyStorePath() {
    def windows = '../keystore.jks'
    def mac = '../keystore.jks'
    return isWindows() ? windows : mac
}

def isWindows() {
    return org.gradle.internal.os.OperatingSystem.current().isWindows();
//    return System.properties['os.name'].contains('windows');
}

build.gradle

apply plugin: 'com.android.application'
apply from: "../util.gradle"


apply plugin: 'com.android.application'
apply from: "../util.gradle"

android {
    compileSdkVersion rootProject.ext.android.compileSdkVersion
    defaultConfig {
        applicationId rootProject.ext.android.applicationId
        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode rootProject.ext.android.versionCode
        versionName rootProject.ext.android.versionName
        multiDexEnabled true
        ndk {
            abiFilters "arm64-v8a", "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }
    signingConfigs {
        sbGoogle {
            storeFile file(rootProject.ext.keyStorePath)
            keyAlias '121'
            keyPassword '212'
            storePassword '121212a'
        }
        release {
            storeFile file(rootProject.ext.keyStorePath)
            keyAlias '1233'
            keyPassword '4@oa'
            storePassword '46565@oa'
        }
    }
}

你可能感兴趣的:(android,studio,macos,android)