apply plugin: 'com.github.ben-manes.versions' buildscript { ext{ kotlin_version = "1.7.22" // for libwg appcompatVersion = '1.1.0' annotationsVersion = '1.0.1' databindingVersion = '3.3.1' jsr305Version = '3.0.2' streamsupportVersion = '1.7.0' threetenabpVersion = '1.1.1' groupName = 'org.amnezia.vpn' } repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0' classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlinx-serialization' apply plugin: 'kotlin-kapt' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation "androidx.security:security-crypto:1.1.0-alpha03" implementation "androidx.security:security-identity-credential:1.0.0-alpha02" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0" coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" implementation project(path: ':shadowsocks') // CameraX core library using the camera2 implementation def camerax_version = "1.2.1" implementation("androidx.camera:camera-core:${camerax_version}") implementation("androidx.camera:camera-camera2:${camerax_version}") implementation("androidx.camera:camera-lifecycle:${camerax_version}") implementation("androidx.camera:camera-view:${camerax_version}") implementation("androidx.camera:camera-extensions:${camerax_version}") def camerax_ml_version = "1.2.0-beta02" def ml_kit_version = "17.0.3" implementation("androidx.camera:camera-mlkit-vision:${camerax_ml_version}") implementation("com.google.mlkit:barcode-scanning:${ml_kit_version}") } androidExtensions { experimental = true } android { /******************************************************* * The following variables: * - androidBuildToolsVersion, * - androidCompileSdkVersion * - qtAndroidDir - holds the path to qt android files * needed to build any Qt application * on Android. * * are defined in gradle.properties file. This file is * updated by QtCreator and androiddeployqt tools. * Changing them manually might break the compilation! *******************************************************/ compileSdkVersion androidCompileSdkVersion.toInteger() buildToolsVersion androidBuildToolsVersion ndkVersion androidNdkVersion // Extract native libraries from the APK packagingOptions.jniLibs.useLegacyPackaging true dexOptions { javaMaxHeapSize "3g" } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = [qtAndroidDir + '/src', 'src', 'java'] aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl'] res.srcDirs = [qtAndroidDir + '/res', 'res'] resources.srcDirs = ['resources'] renderscript.srcDirs = ['src'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] androidTest.assets.srcDirs += files("${qtAndroidDir}/schemas".toString()) } } tasks.withType(JavaCompile) { options.incremental = true } compileOptions { // Flag to enable support for the new language APIs coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 lintOptions { abortOnError false } // Do not compress Qt binary resources file aaptOptions { noCompress 'rcc' } defaultConfig { resConfig "en" minSdkVersion = 24 targetSdkVersion = 31 versionCode 10 // Change to a higher number versionName "2.0.10" // Change to a higher number javaCompileOptions.annotationProcessorOptions.arguments = [ "room.schemaLocation": "${qtAndroidDir}/schemas".toString() ] } buildTypes { release { // That would enable treeshaking and remove java code that is just called from qt minifyEnabled false externalNativeBuild { cmake { arguments "-DANDROID_PACKAGE_NAME=${groupName}", "-DGRADLE_USER_HOME=${project.gradle.gradleUserHomeDir}" } } } debug { //applicationIdSuffix ".debug" //versionNameSuffix "-debug" minifyEnabled false externalNativeBuild { cmake { arguments "-DANDROID_PACKAGE_NAME=${groupName}", "-DGRADLE_USER_HOME=${project.gradle.gradleUserHomeDir}" } } } } // externalNativeBuild { // cmake { // path 'wireguard/CMakeLists.txt' // } // } // externalNativeBuild { // cmake { // path 'openvpn/src/main/cpp/CMakeLists.txt' // } // } }