// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = "1.5.20" ext.objectboxVersion = "3.0.1" repositories { google() mavenCentral() maven{ url = "http://maven.aliyun.com/nexus/content/groups/public/" } maven { url "https://jitpack.io" } } dependencies { classpath "com.android.tools.build:gradle:4.1.3" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() mavenCentral() jcenter() // Warning: this repository is going to shut down soon maven{ url = "http://maven.aliyun.com/nexus/content/groups/public/" } maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } ext { compileSdkVersion = 30 buildToolsVersion = "30.0.0" minSdkVersion = 21 targetSdkVersion = 30 ndkAbis = [ 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64' ] AppKey = '' BaseUrl = '' } def loadLocalConfig() { String env = System.getProperty("env", "test") if (env != "test") env = "online" println "env=$env" def propertiesFile = file("config/${env}.properties") if (!propertiesFile.exists()) { println "Local properties don't exist." return } Properties config = new Properties() config.load(propertiesFile.newInputStream()) this.AppKey = config.getProperty('APP_KEY') this.BaseUrl = config.getProperty('BASE_URL') } loadLocalConfig()