maps: [Bug]: Expo 53 Task :rnmapbox_maps:compileDebugKotlin FAILED

Mapbox Implementation

Mapbox

Mapbox Version

10.1.38

React Native Version

0.79.2

Platform

Android

@rnmapbox/maps version

10.1.38

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Starting project getting error

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 19
  • Comments: 23

Most upvoted comments

There is a pull request that fixes this, applying the patch here fixed the issue for me.

fix(android): support RN 0.77

yarn android
yarn run v1.22.22
$ expo run:android
β€Ί Building app...
Configuration on demand is an incubating feature.

> Configure project :
[ExpoRootProject] Using the following versions:
  - buildTools:  35.0.0
  - minSdk:      24
  - compileSdk:  35
  - targetSdk:   35
  - ndk:         27.1.12297006
  - kotlin:      2.0.21
  - ksp:         2.0.21-1.0.28

> Configure project :app
 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin'

> Configure project :expo

Using expo modules
  - expo-constants (17.1.5)
  - expo-dev-client (5.1.7)
  - expo-dev-launcher (5.1.10)
  - expo-dev-menu (6.1.9)
  - expo-dev-menu-interface (1.10.0)
  - expo-json-utils (0.15.0)
  - expo-manifests (0.16.4)
  - expo-modules-core (2.3.12)
  - expo-updates-interface (1.1.0)
  - [πŸ“¦] expo-asset (11.1.4)
  - [πŸ“¦] expo-blur (14.1.4)
  - [πŸ“¦] expo-file-system (18.1.8)
  - [πŸ“¦] expo-font (13.3.0)
  - [πŸ“¦] expo-haptics (14.1.4)
  - [πŸ“¦] expo-image (2.1.6)
  - [πŸ“¦] expo-keep-awake (14.1.4)
  - [πŸ“¦] expo-linking (7.1.4)
  - [πŸ“¦] expo-splash-screen (0.30.8)
  - [πŸ“¦] expo-system-ui (5.0.7)
  - [πŸ“¦] expo-web-browser (14.1.6)


> Configure project :react-native-reanimated
Android gradle plugin: 8.8.2
Gradle: 8.13

> Task :rnmapbox_maps:compileDebugKotlin
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:252:29 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:252:49 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:252:91 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:255:51 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:255:80 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt:18:27 Unresolved reference 'ViewTreeLifecycleOwner'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt:119:30 Class '<anonymous>' is not abstract and does not implement abstract member 'lifecycle'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt:134:17 'getLifecycle' overrides nothing.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt:138:13 Unresolved reference 'ViewTreeLifecycleOwner'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt:37:16 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt:43:9 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:85:28 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:107:29 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:124:45 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:124:55 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:126:33 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt:126:41 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt:122:40 None of the following candidates is applicable:
fun literal(value: HashMap<String, Any>): Expression
fun literal(value: List<Any>): Expression
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:44:26 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXChangeLineOffsetsShapeAnimatorModule.kt:213:41 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/shapeAnimators/RNMBXChangeLineOffsetsShapeAnimatorModule.kt:213:59 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt:41:42 None of the following candidates is applicable:
static fun valueOf(p0: Double): Value
static fun valueOf(p0: Long): Value
static fun valueOf(p0: Boolean): Value
static fun valueOf(p0: String): Value
static fun valueOf(p0: (MutableList<Value!>..List<Value!>)): Value
static fun valueOf(p0: HashMap<String!, Value!>): Value
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt:42:46 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt:43:42 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableArray.kt:49:53 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableArray.kt:50:57 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?'.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableMap.kt:28:26 Argument type mismatch: actual type is 'kotlin.Any?', but 'kotlin.Any' was expected.
e: file:///home/umar/Files/Coding/React/Expo/public-service/node_modules/@rnmapbox/maps/android/src/main/rn-compat/rn75/com/rnmapbox/rnmbx/rncompat/ReadableMap.kt:6:12 Return type mismatch: expected 'kotlin.collections.Iterator<kotlin.collections.Map.Entry<kotlin.String, kotlin.Any>>', actual 'kotlin.collections.Iterator<kotlin.collections.Map.Entry<kotlin.String, kotlin.Any?>>'.

> Task :rnmapbox_maps:compileDebugKotlin FAILED
The Daemon will expire after the build after running out of JVM Metaspace.
The project memory settings are likely not configured or are configured to an insufficient value.
The daemon will restart for the next build, which may increase subsequent build times.
These settings can be adjusted by setting 'org.gradle.jvmargs' in 'gradle.properties'.
The currently configured max heap space is '2 GiB' and the configured max metaspace is '512 MiB'.
For more information on how to set these values, please refer to https://docs.gradle.org/8.13/userguide/build_environment.html#sec:configuring_jvm_memory in the Gradle documentation.
To disable this warning, set 'org.gradle.daemon.performance.disable-logging=true'.
Daemon will be stopped at the end of the build after running out of JVM Metaspace

[Incubating] Problems report is available at: file:///home/umar/Files/Coding/React/Expo/public-service/android/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':rnmapbox_maps:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 59s
383 actionable tasks: 11 executed, 372 up-to-date
Error: /home/umar/Files/Coding/React/Expo/public-service/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
Error: /home/umar/Files/Coding/React/Expo/public-service/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1
    at ChildProcess.completionListener (/home/umar/Files/Coding/React/Expo/public-service/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
    at Object.onceWrapper (node:events:639:26)
    at ChildProcess.emit (node:events:524:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    ...
    at spawnAsync (/home/umar/Files/Coding/React/Expo/public-service/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
    at spawnGradleAsync (/home/umar/Files/Coding/React/Expo/public-service/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:134:28)
    at assembleAsync (/home/umar/Files/Coding/React/Expo/public-service/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:83:16)
    at runAndroidAsync (/home/umar/Files/Coding/React/Expo/public-service/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:65:24)

I had the same error when upgrading Expo from 52 to 53 and I confirm that upgrading @rnmapbox/maps from 10.1.36 to 10.1.39 fixed it for me.

Don’t forget to run the prebuild comment again to rebuild the native code

Might be unrelated but good damn

Image