From fadf032b35020867ac5455b9a25be995d75029d5 Mon Sep 17 00:00:00 2001 From: christianrowlands Date: Mon, 30 Oct 2023 08:42:23 -0400 Subject: [PATCH] Upgrade to Android API 34 (Android 14) --- .github/workflows/android-release.yaml | 36 ++++++------------- .github/workflows/android.yaml | 36 ++++++------------- build.gradle | 8 ++--- gradle.properties | 3 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- networksurvey/build.gradle | 29 ++++++++------- networksurvey/proguard-rules.pro | 4 +++ .../services/GrpcConnectionService.java | 2 +- .../services/NetworkSurveyService.java | 2 +- 9 files changed, 50 insertions(+), 72 deletions(-) diff --git a/.github/workflows/android-release.yaml b/.github/workflows/android-release.yaml index 238a7c00..47a3481b 100644 --- a/.github/workflows/android-release.yaml +++ b/.github/workflows/android-release.yaml @@ -15,32 +15,25 @@ jobs: strategy: matrix: - api-level: [ 26, 31 ] + api-level: [ 26, 34 ] target: [ default, google_apis ] steps: - name: Checkout the code uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 11 - distribution: 'adopt' + java-version: 17 + distribution: 'temurin' + cache: 'gradle' - name: Save google-services.json env: GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} run: echo "$GOOGLE_SERVICES" > networksurvey/google-services.json - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - name: Unit Tests run: ./gradlew test --stacktrace @@ -118,19 +111,12 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - - name: Set up JDK 11 - uses: actions/setup-java@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 11 - distribution: 'adopt' + java-version: 17 + distribution: 'temurin' + cache: 'gradle' - name: Save Keystore env: diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index 90bbe734..9af403e3 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -19,19 +19,12 @@ jobs: - name: Checkout the code uses: actions/checkout@v4 - - name: Cache dependencies - uses: actions/cache@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: 11 - distribution: 'adopt' + java-version: 17 + distribution: 'temurin' + cache: 'gradle' - name: Save google-services.json env: @@ -66,32 +59,25 @@ jobs: strategy: matrix: - api-level: [ 26, 31 ] + api-level: [ 26, 34 ] target: [ default, google_apis ] steps: - name: Checkout the code uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 11 - distribution: 'adopt' + java-version: 17 + distribution: 'temurin' + cache: 'gradle' - name: Save google-services.json env: GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} run: echo "$GOOGLE_SERVICES" > networksurvey/google-services.json - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - name: Unit Tests run: ./gradlew test --stacktrace diff --git a/build.gradle b/build.gradle index 09340df9..c8c88625 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,11 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.15' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.6' - classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3" + classpath 'com.google.gms:google-services:4.4.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.7.4" } } diff --git a/gradle.properties b/gradle.properties index e708dda6..6f52402f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,9 @@ android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m applicationName=networksurvey +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3d71f5bd..179c034d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/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.0-all.zip diff --git a/networksurvey/build.gradle b/networksurvey/build.gradle index 2164ce09..134320f0 100644 --- a/networksurvey/build.gradle +++ b/networksurvey/build.gradle @@ -6,17 +6,17 @@ apply plugin: 'kotlin-android' ext.androidVersion = '28.0.0' -ext.grpcVersion = '1.45.1' -ext.networkSurveyMessagingVersion = '0.11.1' -ext.navigationVersion = '2.6.0' +ext.grpcVersion = '1.58.0' +ext.networkSurveyMessagingVersion = '0.12.0' +ext.navigationVersion = '2.7.4' android { - compileSdkVersion 33 + compileSdk 34 defaultConfig { buildConfigField "String", "MESSAGING_API_VERSION", "\"${networkSurveyMessagingVersion}\"" applicationId "com.craxiom.networksurvey" minSdkVersion 26 - targetSdkVersion 31 + targetSdkVersion 34 versionCode 49 versionName "1.14-SNAPSHOT" setProperty("archivesBaseName", "$applicationName-$versionName") @@ -34,18 +34,17 @@ android { } } compileOptions { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { viewBinding true dataBinding true } - buildToolsVersion '30.0.3' + packagingOptions { - exclude 'google/cloud/audit/audit_log.proto' resources { - excludes += ['META-INF/INDEX.LIST', 'META-INF/io.netty.versions.properties'] + excludes += ['META-INF/INDEX.LIST', 'META-INF/io.netty.versions.properties', 'google/cloud/audit/audit_log.proto'] } } @@ -71,10 +70,10 @@ android { dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.jakewharton.timber:timber:5.0.1' - implementation 'com.google.android.material:material:1.9.0' + implementation 'com.google.android.material:material:1.10.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.preference:preference-ktx:1.2.0' + implementation 'androidx.preference:preference-ktx:1.2.1' implementation "androidx.navigation:navigation-runtime-ktx:${navigationVersion}" implementation "androidx.navigation:navigation-fragment-ktx:${navigationVersion}" implementation "androidx.navigation:navigation-ui-ktx:${navigationVersion}" @@ -92,7 +91,7 @@ dependencies { implementation("com.craxiom:network-survey-messaging:${networkSurveyMessagingVersion}") { exclude group: 'com.google.api.grpc', module: 'proto-google-common-protos' } - implementation "com.google.protobuf:protobuf-java-util:3.19.3" + implementation "com.google.protobuf:protobuf-java-util:3.24.3" implementation "mil.nga.geopackage:geopackage-android:6.6.0" implementation 'org.apache.commons:commons-csv:1.9.0' @@ -100,7 +99,7 @@ dependencies { implementation 'com.craxiom:mqtt-library:0.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.recyclerview:recyclerview:1.3.0' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'app.futured.donut:donut:2.2.0' @@ -115,7 +114,7 @@ dependencies { regularImplementation 'com.google.firebase:firebase-crashlytics' testImplementation 'junit:junit:4.13.2' - implementation 'androidx.annotation:annotation:1.6.0' + implementation 'androidx.annotation:annotation:1.7.0' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test:runner:1.5.2' diff --git a/networksurvey/proguard-rules.pro b/networksurvey/proguard-rules.pro index 97f6f95a..bdad687c 100644 --- a/networksurvey/proguard-rules.pro +++ b/networksurvey/proguard-rules.pro @@ -17,6 +17,10 @@ -keepattributes SourceFile,LineNumberTable -dontobfuscate +-keep class com.google.gson.reflect.TypeToken +-keep class * extends com.google.gson.reflect.TypeToken +-keep public class * implements java.lang.reflect.Type + # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/services/GrpcConnectionService.java b/networksurvey/src/main/java/com/craxiom/networksurvey/services/GrpcConnectionService.java index e9154677..dd3e2ceb 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/services/GrpcConnectionService.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/services/GrpcConnectionService.java @@ -1079,7 +1079,7 @@ public void onServiceConnected(final ComponentName name, final IBinder iBinder) Timber.i("%s service connected", name); final NetworkSurveyService.SurveyServiceBinder binder = (NetworkSurveyService.SurveyServiceBinder) iBinder; networkSurveyService = (NetworkSurveyService) binder.getService(); - deviceId = networkSurveyService.getDeviceId(); + deviceId = networkSurveyService.getNsDeviceId(); gpsListener = networkSurveyService.getGpsListener(); networkSurveyService.registerCellularSurveyRecordListener(GrpcConnectionService.this); networkSurveyService.registerWifiSurveyRecordListener(GrpcConnectionService.this); diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/services/NetworkSurveyService.java b/networksurvey/src/main/java/com/craxiom/networksurvey/services/NetworkSurveyService.java index b0166370..3c715cd1 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/services/NetworkSurveyService.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/services/NetworkSurveyService.java @@ -524,7 +524,7 @@ public GpsListener getGpsListener() return gpsListener; } - public String getDeviceId() + public String getNsDeviceId() { return deviceId; }