def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY'); def buildAsApplication = !buildAsLibrary if (buildAsApplication) { apply plugin: 'com.android.application' } else { apply plugin: 'com.android.library' } android { ndkVersion "26.0.10792818" namespace 'com.dishii.soh' compileSdkVersion 31 buildFeatures { buildConfig = true } defaultConfig { if (buildAsApplication) { applicationId "com.dishii.soh" } minSdkVersion 24 targetSdkVersion 33 versionCode 8 versionName "9.0.2" } buildTypes { debug { externalNativeBuild { cmake { arguments "-DSDL_SHARED=ON", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF",'-DUSE_OPENGLES=ON' abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' } } proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { minifyEnabled false debuggable false jniDebuggable false signingConfig signingConfigs.debug externalNativeBuild { cmake { arguments "-DSDL_SHARED=ON", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF",'-DUSE_OPENGLES=ON' abiFilters 'arm64-v8a' } } proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } applicationVariants.all { variant -> tasks["merge${variant.name.capitalize()}Assets"] .dependsOn("externalNativeBuild${variant.name.capitalize()}") variant.outputs.all { output -> def projectName = rootProject.name def buildType = variant.buildType.name def versionName = variant.versionName def versionCode = variant.versionCode def newApkName = "soh_${buildType}_v${versionName}.apk" outputFileName = newApkName } } if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { sourceSets.main { jniLibs.srcDir 'libs' } externalNativeBuild { //ndkBuild { // path 'jni/Android.mk' //} cmake { path '../../CMakeLists.txt' version "3.31.5" } } } lintOptions { abortOnError false } if (buildAsLibrary) { libraryVariants.all { variant -> variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith(".aar")) { def fileName = "org.libsdl.app.aar"; output.outputFile = new File(outputFile.parent, fileName); } } } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.core:core:1.7.0' // Use the latest version implementation 'androidx.constraintlayout:constraintlayout:2.1.4' } task wrapper(type: Wrapper) { gradleVersion = '8.10.2' } task prepareKotlinBuildScriptModel { }