From 26f00f1e8e2cc4b25974b10fcdc314783c3c48ba Mon Sep 17 00:00:00 2001 From: Alex Cristici Date: Thu, 3 Oct 2024 21:55:55 +0300 Subject: [PATCH] Android 10 compilation fixes (#2898) --- .../android/MapboxGLAndroidSDK/build.gradle | 9 ++++++++ .../mapboxsdk/style/sources/GeoJsonSource.kt | 2 +- .../MapboxGLAndroidSDKLint/build.gradle | 8 +++---- .../MapboxGLAndroidSDKTestApp/build.gradle | 15 ++++++++----- .../view/LockableBottomSheetBehavior.kt | 22 +++++++++++++------ platform/android/build.gradle | 2 +- platform/android/gradle.properties | 5 ++++- platform/android/gradle/dependencies.gradle | 4 ++-- .../gradle/wrapper/gradle-wrapper.properties | 6 ++--- 9 files changed, 49 insertions(+), 24 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index aecd63cb035..274da62da7f 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -88,6 +88,15 @@ android { disable 'MissingTranslation', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'MissingPermission', 'WrongThreadInterprocedural' warningsAsErrors false } + + compileOptions { + sourceCompatibility = 11 + targetCompatibility = 11 + } + + kotlinOptions { + jvmTarget = "11" + } } licenseReport { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.kt b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.kt index 87b3972b65e..56fa7ddf1cb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.kt +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.kt @@ -372,7 +372,7 @@ class GeoJsonSource : Source { /** * @return The url or null */ - @get:Deprecated("use {@link #getUri()} instead") + @Deprecated("use {@link #getUri()} instead") get() { return getUrlInternal() } diff --git a/platform/android/MapboxGLAndroidSDKLint/build.gradle b/platform/android/MapboxGLAndroidSDKLint/build.gradle index 1e0952d91e9..bbe1aa3b945 100644 --- a/platform/android/MapboxGLAndroidSDKLint/build.gradle +++ b/platform/android/MapboxGLAndroidSDKLint/build.gradle @@ -19,18 +19,18 @@ dependencies { testImplementation dependenciesList.lintTests } -sourceCompatibility = "1.8" -targetCompatibility = "1.8" +sourceCompatibility = "11" +targetCompatibility = "11" compileKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } } compileTestKotlin { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 98939db22d4..0a2b54b8c20 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -3,6 +3,7 @@ plugins { id 'com.android.application' } +apply plugin: 'kotlin-android' apply from: "${rootDir}/gradle/native-build.gradle" android { @@ -18,11 +19,6 @@ android { multiDexEnabled = true } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - nativeBuild(["example-custom-layer"]) packagingOptions { resources { @@ -59,6 +55,15 @@ android { disable 'MissingTranslation', 'GoogleAppIndexingWarning', 'UnpackedNativeCode', 'IconDipSize', 'TypographyQuotes' warningsAsErrors true } + + compileOptions { + sourceCompatibility = 11 + targetCompatibility = 11 + } + + kotlinOptions { + jvmTarget = "11" + } } dependencies { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/view/LockableBottomSheetBehavior.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/view/LockableBottomSheetBehavior.kt index b65cecf54ef..e783ab5fe5e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/view/LockableBottomSheetBehavior.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/view/LockableBottomSheetBehavior.kt @@ -1,4 +1,4 @@ -package com.mapbox.mapboxsdk.testapp.view +package org.maplibre.android.testapp.view import android.content.Context import android.util.AttributeSet @@ -16,7 +16,7 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS override fun onInterceptTouchEvent( parent: CoordinatorLayout, - child: V, + child: V & Any, event: MotionEvent ): Boolean { var handled = false @@ -26,7 +26,11 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS return handled } - override fun onTouchEvent(parent: CoordinatorLayout, child: V, event: MotionEvent): Boolean { + override fun onTouchEvent( + parent: CoordinatorLayout, + child: V & Any, + event: MotionEvent + ): Boolean { var handled = false if (!locked) { handled = super.onTouchEvent(parent, child, event) @@ -36,7 +40,7 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS override fun onStartNestedScroll( coordinatorLayout: CoordinatorLayout, - child: V, + child: V & Any, directTargetChild: View, target: View, nestedScrollAxes: Int @@ -56,7 +60,7 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS override fun onNestedPreScroll( coordinatorLayout: CoordinatorLayout, - child: V, + child: V & Any, target: View, dx: Int, dy: Int, @@ -67,7 +71,11 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS } } - override fun onStopNestedScroll(coordinatorLayout: CoordinatorLayout, child: V, target: View) { + override fun onStopNestedScroll( + coordinatorLayout: CoordinatorLayout, + child: V & Any, + target: View + ) { if (!locked) { super.onStopNestedScroll(coordinatorLayout, child, target) } @@ -75,7 +83,7 @@ class LockableBottomSheetBehavior(context: Context, attrs: AttributeS override fun onNestedPreFling( coordinatorLayout: CoordinatorLayout, - child: V, + child: V & Any, target: View, velocityX: Float, velocityY: Float diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 3b190e3fc7b..9636b9c4da4 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.0' + classpath 'com.android.tools.build:gradle:8.7.0' classpath dependenciesList.licensesPlugin classpath dependenciesList.kotlinPlugin // classpath dependenciesList.jacocoPlugin diff --git a/platform/android/gradle.properties b/platform/android/gradle.properties index 2960c164e60..d33f742c31a 100644 --- a/platform/android/gradle.properties +++ b/platform/android/gradle.properties @@ -1,4 +1,7 @@ android.useAndroidX=true systemProp.org.gradle.internal.http.connectionTimeout=360000 systemProp.org.gradle.internal.http.socketTimeout=360000 -org.gradle.jvmargs=-Xmx4096M \ No newline at end of file +org.gradle.jvmargs=-Xmx4096M +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 641794ee2f5..d4a770fe51e 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -34,8 +34,8 @@ ext { robolectric : '4.9.1', timber : '5.0.1', okhttp : '4.10.0', - kotlin : '1.7.20', - licenses : '0.8.80', + kotlin : '2.0.20', + licenses : '0.9.8', lint : '30.3.1', // jacoco : '0.8.5', appcenter : '1.5', diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties index 62f4c40d8ac..9b30465e7cb 100644 --- a/platform/android/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Dec 15 15:24:50 PST 2022 +#Thu Oct 03 18:19:48 EEST 2024 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists