Skip to content

Commit 77d0a09

Browse files
jushkiryldz
andauthored
Support compile SDK 30 (#2147)
Co-authored-by: Kiryl Dzehtsiarenka <[email protected]> fix robolectric/robolectric#7786
1 parent 5fb2599 commit 77d0a09

File tree

7 files changed

+53
-31
lines changed

7 files changed

+53
-31
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Mapbox welcomes participation and contributions from everyone.
77
* Fix widgets flickering due to race condition if they are animated.
88
* Fix widgets not showing on some zoom levels.
99
* Fix map being black when using widgets (e.g. when `MapDebugOptions.TILE_BORDERS` option is enabled).
10+
# 10.yy.zz
11+
## Features ✨ and improvements 🏁
12+
* Downgrade minimum required `compileSDK` from 31 to 30.
13+
14+
## Dependencies
15+
* Update Mapbox gestures library to 0.9.1
1016

1117
# 10.16.2 November 08, 2023
1218
## Bug fixes 🐞

LICENSE.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
138138

139139
Mapbox Maps Android uses portions of the Android Support Library compat.
140140

141-
URL: [https://developer.android.com/jetpack/androidx/releases/core#1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)
141+
URL: [https://developer.android.com/jetpack/androidx/releases/core#1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)
142142

143143
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
144144

@@ -216,17 +216,9 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens
216216

217217
===========================================================================
218218

219-
Mapbox Maps Android uses portions of the AndroidX Futures.
220-
221-
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
222-
223-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
224-
225-
===========================================================================
226-
227219
Mapbox Maps Android uses portions of the Core Kotlin Extensions.
228220

229-
URL: [https://developer.android.com/jetpack/androidx/releases/core#1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)
221+
URL: [https://developer.android.com/jetpack/androidx/releases/core#1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)
230222

231223
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
232224

@@ -246,12 +238,6 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
246238

247239
===========================================================================
248240

249-
Mapbox Maps Android uses portions of the Guava ListenableFuture only.
250-
251-
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
252-
253-
===========================================================================
254-
255241
Mapbox Maps Android uses portions of the IntelliJ IDEA Annotations.
256242

257243
URL: [http://www.jetbrains.org](http://www.jetbrains.org)

app/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ apply {
1212
val buildFromSource: String by project
1313

1414
android {
15-
compileSdk = AndroidVersions.ExampleApp.compileSdkVersion
15+
compileSdk = (project.findProperty("APP_USE_COMPILE_SDK") as String?)?.toInt() ?: AndroidVersions.ExampleApp.defaultCompileSdkVersion
16+
logger.warn("Using compileSDK: $compileSdk")
1617
signingConfigs {
1718
create("release") {
1819
storeFile = rootProject.file("$rootDir/testapp-release.keystore")
@@ -36,7 +37,7 @@ android {
3637
defaultConfig {
3738
applicationId = "com.mapbox.maps.testapp"
3839
minSdk = AndroidVersions.ExampleApp.minSdkVersion
39-
targetSdk = AndroidVersions.ExampleApp.targetSdkVersion
40+
targetSdk = this@android.compileSdk
4041
versionCode = if (project.hasProperty("gitVersionCode")) project.property("gitVersionCode") as Int else 1
4142
versionName = if (project.hasProperty("gitVersionName")) project.property("gitVersionName") as String else "0.1.0"
4243
multiDexEnabled = true
@@ -117,8 +118,9 @@ dependencies {
117118
implementation(Dependencies.androidxMultidex)
118119
implementation(Dependencies.googleMaterialDesign)
119120
implementation(Dependencies.squareRetrofit)
120-
implementation(Dependencies.androidxFragmentTest)
121121
implementation(Dependencies.squareRetrofitGsonConverter)
122+
// AndroidX Fragment Test is `implementation` because it requires exposing an internal activity in Manifest
123+
implementation(Dependencies.androidxFragmentTest)
122124

123125
// By default, the Maps SDK uses the Android Location Provider to obtain raw location updates.
124126
// And with Android 11, the raw location updates might suffer from precision issue.

app/src/main/AndroidManifest.xml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@
119119
android:name=".examples.java.DSLStylingJavaActivity"
120120
android:description="@string/description_dsl_styling"
121121
android:exported="true"
122-
android:label="@string/activity_dsl_styling"></activity>
122+
android:label="@string/activity_dsl_styling" />
123123
<activity
124124
android:name=".examples.java.RuntimeStylingJavaActivity"
125125
android:description="@string/description_dsl_styling"
126126
android:exported="true"
127-
android:label="@string/activity_dsl_styling"></activity>
127+
android:label="@string/activity_dsl_styling" />
128128
<activity
129129
android:name=".examples.globe.HeatmapLayerGlobeActivity"
130130
android:description="@string/description_heatmap_layer"
@@ -986,6 +986,7 @@
986986
</activity>
987987
<activity
988988
android:name=".examples.SecondaryDisplayActivity"
989+
android:exported="true"
989990
android:launchMode="singleTask">
990991
<meta-data
991992
android:name="android.allow_multiple_resumed_activities"
@@ -1225,5 +1226,22 @@
12251226
<meta-data
12261227
android:name="com.mapbox.maps.ThreadChecker"
12271228
android:value="true" />
1229+
1230+
<!--
1231+
androidx.test:core:1.3.0 doesn't define "exported" attribute required for Android 12+ so we
1232+
set it here explicitly
1233+
-->
1234+
<activity
1235+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
1236+
android:exported="false"
1237+
tools:node="mergeOnlyAttributes" />
1238+
<activity
1239+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
1240+
android:exported="false"
1241+
tools:node="mergeOnlyAttributes" />
1242+
<activity
1243+
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
1244+
android:exported="false"
1245+
tools:node="mergeOnlyAttributes" />
12281246
</application>
12291247
</manifest>

build.gradle.kts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,18 @@ repositories {
7777
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
7878
outputDirectory.set(buildDir.resolve(this.name))
7979
}
80-
tasks.withType<Test> {
81-
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
80+
81+
// hack to fix unit test, see https://github.com/robolectric/robolectric/issues/5131#issuecomment-509631890.
82+
subprojects {
83+
tasks.withType<Test>().configureEach {
84+
maxParallelForks = 2
85+
setForkEvery(80)
86+
setMaxHeapSize("2048m")
87+
setMinHeapSize("1024m")
88+
}
8289
}
8390

91+
8492
apiValidation {
8593
/**
8694
* Packages that are excluded from public API dumps even if they

buildSrc/src/main/kotlin/Project.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
@file:Suppress("ConstPropertyName")
2+
13
object AndroidVersions {
24
const val minSdkVersion = 21
35
const val targetSdkVersion = 30
4-
const val compileSdkVersion = 31
6+
const val compileSdkVersion = 30
57
object AndroidAuto {
68
const val minSdkVersion = 23
79
const val targetSdkVersion = 30
@@ -14,8 +16,7 @@ object AndroidVersions {
1416
}
1517
object ExampleApp {
1618
const val minSdkVersion = 23
17-
const val targetSdkVersion = 33
18-
const val compileSdkVersion = 33
19+
const val defaultCompileSdkVersion = 33
1920
}
2021
}
2122

@@ -110,19 +111,19 @@ object Versions {
110111
const val pluginTaskTree = "2.1.0"
111112
const val mapboxAccessToken="0.4.0"
112113
const val mapboxSdkRegistry="1.2.2"
113-
const val mapboxGestures = "0.8.0"
114+
const val mapboxGestures = "0.9.1" // Required to support compile SDK 30
114115
const val mapboxJavaServices = "5.4.1"
115116
const val mapboxBase = "0.8.0"
116117
const val mapboxGlNative = "10.16.2"
117118
const val mapboxCommon = "23.8.4"
118-
const val androidxCore = "1.7.0" // last version compatible with kotlin 1.5.31
119-
const val androidxFragmentTesting = "1.5.0"
119+
const val androidxCore = "1.6.0" // Latest version that supports compile SDK 30
120+
const val androidxFragmentTesting = "1.3.6" // Latest version that supports compile SDK 30
120121
const val androidxAnnotation = "1.1.0"
121122
const val androidxAppcompat = "1.3.0"
122123
const val androidxTest = "1.4.0"
123124
const val androidxArchCoreTest = "2.1.0"
124125
const val androidxConstraintLayout = "2.0.0"
125-
const val androidxEspresso = "3.4.0"
126+
const val androidxEspresso = "3.3.0" // Newer version either require compile SDK >30 or we hit crash "java.lang.NoSuchMethodError: No static method loadSingleServiceOrNull
126127
const val androidxJUnit = "1.1.3"
127128
const val androidxUiAutomator = "2.2.0"
128129
const val androidxRecyclerView = "1.1.0"
@@ -139,7 +140,7 @@ object Versions {
139140
const val kotlinCoroutines = "1.3.9"
140141
const val junit = "4.13.2"
141142
const val mockk = "1.12.3"
142-
const val robolectric = "4.8.1"
143+
const val robolectric = "4.11.1"
143144
const val robolectricEgl = "gl1.1-android-2.1_r1"
144145
const val lint = "30.0.4"
145146
const val hamcrest = "2.1"

sdk-base/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ android {
2222
buildConfigField("String", "MAPBOX_SDK_VERSION", String.format("\"%s\"", VERSION_NAME))
2323
buildConfigField("String", "MAPBOX_VERSION_STRING", String.format("\"Mapbox/%s\"", VERSION_NAME))
2424
buildConfigField("String", "MAPBOX_EVENTS_USER_AGENT", String.format("\"mapbox-maps-android/%s\"", VERSION_NAME))
25+
aarMetadata.minCompileSdk = AndroidVersions.compileSdkVersion
2526
}
2627

2728
flavorDimensions.add("version")

0 commit comments

Comments
 (0)