apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { compileSdkVersion 32 buildToolsVersion '33.0.0' ndkVersion '23.2.8568313' defaultConfig { applicationId 'com.multicraft.game' minSdkVersion 21 targetSdkVersion 32 versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionCode project.versionCode } // load properties Properties props = new Properties() def propfile = file('../local.properties') if (propfile.exists()) props.load(new FileInputStream(propfile)) if (props.getProperty('keystore') != null) { signingConfigs { release { storeFile file(props['keystore']) storePassword props['keystore.password'] keyAlias props['key'] keyPassword props['key.password'] } } buildTypes { release { shrinkResources true minifyEnabled true signingConfig signingConfigs.release } debug { debuggable true minifyEnabled false } } } // for multiple APKs splits { abi { enable true reset() include 'armeabi-v7a', 'arm64-v8a' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } buildFeatures { viewBinding true } } import org.apache.tools.ant.taskdefs.condition.Os task prepareAssetsFiles() { def assetsFolder = "build/assets/Files" def projRoot = "../../.." copy { from "${projRoot}/builtin" into "${assetsFolder}/builtin" exclude '*.txt' } copy { from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders" } copy { from "../native/deps/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht" } copy { from "${projRoot}/fonts/MultiCraftFont.ttf" into "${assetsFolder}/fonts" } fileTree("${projRoot}/po").include("**/*.po").forEach { poFile -> def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/" file(moPath).mkdirs() if (!Os.isFamily(Os.FAMILY_WINDOWS)) { exec { commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile } } } copy { from "${projRoot}/textures" into "${assetsFolder}/textures" exclude '*.txt' } task zipAssetsFiles(type: Zip) { archiveFileName = "Files.zip" destinationDirectory = file("src/main/assets/data") from "${assetsFolder}" } } task prepareAssetsGames() { def assetsFolder = "build/assets/games" def projRoot = "../../.." def gameToCopy = "default" copy { from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}" } task zipAssetsGames(type: Zip) { archiveFileName = "games.zip" destinationDirectory = file("src/main/assets/data") from "${assetsFolder}" } } preBuild.dependsOn zipAssetsFiles preBuild.dependsOn zipAssetsGames // Map for the version code that gives each ABI a value. def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1] android.applicationVariants.all { variant -> variant.outputs.each { output -> def abiName = output.filters[0].identifier output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode } } dependencies { /* MultiCraft Native */ implementation project(':native') /* Third-party libraries */ implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'androidx.appcompat:appcompat-resources:1.4.2' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0' implementation 'androidx.work:work-runtime-ktx:2.7.1' implementation 'com.google.android.material:material:1.6.1' }