android: Update Gradle plugin and build scripts and dependencies

This also references the NDK via ndkVersion and replaces the custom
ndk-build tasks.  It also replaces the deprecated compileSdkVersion and
increases it because dependencies of updated dependencies require that.

targetSdkVersion is not yet updated because there might be some work
required for Android 14 compatibility.
This commit is contained in:
Tobias Brunner committed 2024-01-16 11:00:29 +01:00
1 parent be832378db
commit 1cab544c75
4 files changed
+25 -26

No files matched your search

+19 -22
View File
@@ -1,39 +1,36 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 33
namespace 'org.strongswan.android'
defaultConfig {
applicationId "org.strongswan.android"
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
versionCode 80
versionName "2.4.2"
externalNativeBuild {
ndkBuild {
arguments '-j' + Runtime.runtime.availableProcessors()
}
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
ndkVersion "26.1.10909125"
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
task buildNative(type: Exec) {
workingDir 'src/main/jni'
commandLine "${android.ndkDirectory}/ndk-build", '-j', Runtime.runtime.availableProcessors()
tasks.withType(JavaCompile).configureEach {
compileTask ->
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
task cleanNative(type: Exec) {
workingDir 'src/main/jni'
commandLine "${android.ndkDirectory}/ndk-build", 'clean'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
clean.dependsOn 'cleanNative'
buildTypes {
release {
minifyEnabled false
@@ -47,10 +44,10 @@ android {
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.11.2'
testImplementation 'org.powermock:powermock-core:2.0.9'