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
2024-01-16 11:00:29 +01:00
parent be832378db
commit 1cab544c75
4 changed files with 25 additions and 26 deletions
+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'
+1 -1
View File
@@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.2.0'
}
}
+4 -2
View File
@@ -1,2 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip