apply plugin: 'com.android.application' apply plugin: "kotlin-multiplatform" apply plugin: "jacoco" //See: // https://developer.android.com/studio/projects/android-library.html //As Per https://developer.android.com/studio/publish/app-signing.html#release-mode def keyStoreFile = System.getenv("KEYSTORE") if(keyStoreFile == null) { keyStoreFile = "keystore.properties" } def keyStorePropertiesExists = rootProject.file(keyStoreFile).exists() def keystoreProperties = new Properties() def baseAppId = "org.kaisipan.mobile" if (keyStorePropertiesExists) { keystoreProperties.load(new FileInputStream(rootProject.file(keyStoreFile))) } kotlin { targets { fromPreset(presets.android, 'android') } } android { //APK splitting would interfere with sideloading the app between different targets and the size //reduction will be minimal bundle { language { enableSplit = false } density { enableSplit = false } abi { enableSplit = false } } buildFeatures { dataBinding true } compileSdkVersion rootProject.ext.version_android_compile_sdk kotlinOptions { jvmTarget = "1.8" } packagingOptions { resources { // .kotlin_metadata files come from multiplatform modules, but are not needed unless we // use kotlin reflection, which we don't. excludes += ['META-INF/INDEX.LIST', '**/*.kotlin_metadata', 'META-INF/*.kotlin_module'] } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 coreLibraryDesugaringEnabled true } defaultConfig { applicationId "${baseAppId}" resConfigs 'en', 'fa', 'ps', 'ar', 'tg', 'bn', 'ne', 'my', 'ru', 'tl' minSdkVersion 21 targetSdkVersion 31 versionCode rootProject.ext.ustadVersionCode versionName rootProject.ext.ustadVersion multiDexEnabled true //required for all variants to use java library desugaring buildConfigField "String", "ACRA_HTTP_URI", "\"" + rootProject.ext.buildConfigProperties["android.acra.url"] + "\"" buildConfigField "String", "ACRA_BASIC_LOGIN", "\"" + rootProject.ext.buildConfigProperties["android.acra.user"] + "\"" buildConfigField "String", "ACRA_BASIC_PASS", "\"" + rootProject.ext.buildConfigProperties["android.acra.auth"] + "\"" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { release { keyAlias keyStorePropertiesExists ? keystoreProperties['keyAlias'] : "default" keyPassword keyStorePropertiesExists ? keystoreProperties['keyPassword'] : "default" storeFile keyStorePropertiesExists ? file(keystoreProperties['storeFile']) : new File("keystore.ks") storePassword keyStorePropertiesExists ? keystoreProperties['storePassword'] : "default" } } dexOptions { jumboMode = true } buildTypes { debug { testCoverageEnabled = true } release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } lint { abortOnError false } namespace 'com.toughra.ustadmobile.launcher' } configurations.all { resolutionStrategy { force "androidx.lifecycle:lifecycle-livedata-core:$version_androidx_lifecycle" force "androidx.lifecycle:lifecycle-runtime:$version_androidx_lifecycle" force "androidx.arch.core:core-runtime:$version_androidx_arch" force "androidx.recyclerview:recyclerview:$version_androidx_recyclerview" } exclude group: "net.sf.kxml", module: "kxml2" exclude group: "org.json", module: "json" } /* * This causes a problem on app-android-launcher on de-contentjob branch for no apparent reason, but * resolves itself in the replication branch. The lint task throws a noclassdeffoundexception */ tasks.whenTaskAdded { task -> if (task.name.startsWith("lint")) { task.enabled = false } if(task.name == "bundleRelease") { build.dependsOn(task) } } dependencies { coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$version_android_desugar_jdk_libs" api project(':core') api project(':sharedse') api project(":app-android") implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version_kotlin" implementation "io.github.aakira:napier:$version_napier" implementation "com.google.android.material:material:$version_android_material" debugImplementation "com.squareup.leakcanary:leakcanary-android:$version_android_leakcanary" //Crash reporting implementation "ch.acra:acra-http:$version_android_acra" implementation "ch.acra:acra-dialog:$version_android_acra" //dependency injection implementation "org.kodein.di:kodein-di-framework-android-x:$version_kodein_di" androidTestImplementation "org.mockito:mockito-android:$version_android_mockito" testImplementation "junit:junit:$version_junit" }