From: Tobias Brunner Date: Tue, 12 Dec 2023 16:19:18 +0000 (+0100) Subject: android: Update Gradle plugin and build scripts and dependencies X-Git-Tag: android-2.5.0~14 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1cab544c759749a899b439acb4fae1fb58279db8;p=thirdparty%2Fstrongswan.git 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. --- diff --git a/src/frontends/android/app/build.gradle b/src/frontends/android/app/build.gradle index 33569f1c3e..35ecdcbb9d 100644 --- a/src/frontends/android/app/build.gradle +++ b/src/frontends/android/app/build.gradle @@ -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" - } - sourceSets.main { - jniLibs.srcDir 'src/main/libs' + externalNativeBuild { + ndkBuild { + arguments '-j' + Runtime.runtime.availableProcessors() + } + } } - task buildNative(type: Exec) { - workingDir 'src/main/jni' - commandLine "${android.ndkDirectory}/ndk-build", '-j', Runtime.runtime.availableProcessors() - } + ndkVersion "26.1.10909125" - task cleanNative(type: Exec) { - workingDir 'src/main/jni' - commandLine "${android.ndkDirectory}/ndk-build", 'clean' + externalNativeBuild { + ndkBuild { + path 'src/main/jni/Android.mk' + } } - tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn buildNative - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + tasks.withType(JavaCompile).configureEach { + compileTask -> + 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' diff --git a/src/frontends/android/build.gradle b/src/frontends/android/build.gradle index dc4fab06bb..2b505ba48c 100644 --- a/src/frontends/android/build.gradle +++ b/src/frontends/android/build.gradle @@ -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' } } diff --git a/src/frontends/android/gradle.properties b/src/frontends/android/gradle.properties index 5465fec0ec..f8b6780adf 100644 --- a/src/frontends/android/gradle.properties +++ b/src/frontends/android/gradle.properties @@ -1,2 +1,4 @@ -android.enableJetifier=true -android.useAndroidX=true \ No newline at end of file +android.enableJetifier=false +android.nonFinalResIds=false +android.nonTransitiveRClass=false +android.useAndroidX=true diff --git a/src/frontends/android/gradle/wrapper/gradle-wrapper.properties b/src/frontends/android/gradle/wrapper/gradle-wrapper.properties index 5cabee55dc..d219d263ca 100644 --- a/src/frontends/android/gradle/wrapper/gradle-wrapper.properties +++ b/src/frontends/android/gradle/wrapper/gradle-wrapper.properties @@ -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