cannot run npm run android after installing "@rnmapbox/maps": "^10.1.33" #3762
Replies: 1 comment 3 replies
-
Lets hope to get an answer i am too facing this Issue.Is it Resolved |
Beta Was this translation helpful? Give feedback.
-
Lets hope to get an answer i am too facing this Issue.Is it Resolved |
Beta Was this translation helpful? Give feedback.
-
in my current project when i try to integrate rnmapbox in my react native application i cant run the command npm run android i get the following errors
Task :rnmapbox_maps:compileDebugKotlin FAILED
then TONS of other line like
BUILD FAILED in 8s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /app/prod/node_modules/react-native-orientation-locker/android/src/main/java/org/wonday/orientation/OrientationModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: file:///app/prod/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:///app/prod/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:
**EERORS LIST
Compilation Errors:**
Kotlin Compilation Errors in
@rnmapbox
/maps package:
Multiple instances of Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableArray?' or similar errors with ReadableMap?.
Errors related to unresolved references like 'ViewTreeLifecycleOwner'.
Issues with method overriding, such as 'getLifecycle' overrides nothing.
Type mismatch errors like actual type is 'kotlin.String?', but 'kotlin.String' was expected.
Errors indicating none of the provided function candidates are applicable, e.g., for literal(value: ...) functions.
Return type mismatches, such as in ReadableMap.kt.
MY PROJECT gradle version
./gradlew --version
Gradle 8.12.1
Build time: 2025-01-24 12:55:12 UTC
Revision: 0b1ee1ff81d1f4a26574ff4a362ac9180852b140
Kotlin: 2.0.21
Groovy: 3.0.22
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM: 17.0.13 (Ubuntu 17.0.13+11-Ubuntu-2ubuntu122.04)
Daemon JVM: /usr/lib/jvm/java-17-openjdk-amd64 (no JDK specified, using current Java home)
OS: Linux 6.5.0-35-generic amd64
app/prod/android#
package.json
"dependencies": {
"@react-navigation/native": "^7.0.14",
"@react-navigation/native-stack": "^7.2.0",
"@react-navigation/stack": "^7.1.1",
"@rnmapbox/maps": "^10.1.33",
"express": "^4.21.2",
"react": "18.3.1",
"react-native": "0.77.0",
"react-native-haptic-feedback": "^2.3.3",
"react-native-orientation-locker": "^1.7.0",
"react-native-safe-area-context": "^5.1.0",
"react-native-screens": "^4.5.0",
"react-native-svg": "^15.11.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.77.0",
"@react-native/eslint-config": "0.77.0",
"@react-native/metro-config": "0.77.0",
"@react-native/typescript-config": "0.77.0",
"@types/jest": "^29.5.13",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
HOW I INTERGRATED THE rnmapbox/maps
1 npm i @rnmapbox/maps
import React, {Component} from 'react';
import {StyleSheet, View} from 'react-native';
import Mapbox, {MapView} from '@rnmapbox/maps';
Mapbox.setAccessToken(
'my token here',
);
const styles = StyleSheet.create({
page: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
container: {
height: 300,
width: 300,
backgroundColor: 'tomato',
},
map: {
flex: 1,
},
});
export default class App extends Component {
componentDidMount() {
Mapbox.setTelemetryEnabled(false);
}
render() {
return (
);
}
}
my android/build.gradle
buildscript {
ext {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
allprojects {
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be
mapbox
(not your username).username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "hard coded token here"
}
}
}
}
}
apply plugin: "com.facebook.react.rootproject"
added MAPBOX_DOWNLOADS_TOKEN in android/gradle.properties
added token in app.json
"plugins": [
[
"@rnmapbox/maps",
{
"MAPBOX_ACCESS_TOKEN": "YOUR_MAPBOX_ACCESS_TOKEN_HERE"
}
]
]
Beta Was this translation helpful? Give feedback.
All reactions