maps: Can't build on Android [RN 0.72.14]
Continuation of https://github.com/rnmapbox/maps/issues/3593
Environment
- Dev OS: OSX 14.5
- @rnmapbox/maps version: 10.1.30
- React Native version: 0.72.14
- Expo version: -
Steps to reproduce
npx react-native@0.72.14 init sample --version 0.72.14
cd sample
yarn add @rnmapbox/maps
# Android Setup
yarn android
Result
> Task :rnmapbox_maps:processDebugManifest
package="com.rnmapbox.rnmbx" found in source AndroidManifest.xml: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
> Task :rnmapbox_maps:compileDebugKotlin
'compileDebugJavaWithJavac' task (current target is 11) and 'compileDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
> Task :rnmapbox_maps:compileDebugKotlin FAILED
45 actionable tasks: 40 executed, 5 up-to-date
info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt: (212, 5): 'addView' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt: (227, 5): 'removeView' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt: (236, 5): 'removeAllViews' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt: (13, 5): 'getChildAt' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt: (17, 5): 'getChildCount' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt: (21, 5): 'addView' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt: (25, 5): 'removeViewAt' overrides nothing
e: /Users/username/Projects/sample/node_modules/@rnmapbox/maps/android/src/main/rn-compat/rn75/com/rnmapbox/rnmbx/rncompat/ResourceDrawableIdHelper.kt: (5, 37): Unresolved reference: Companion
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':rnmapbox_maps:compileDebugKotlin'.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 25 (8 by maintainers)
I can confirm this is working for me
I fixed by changing to:
https://github.com/rnmapbox/maps/issues/3598#issuecomment-2316145748
Remove the
^. What is your RN version?I also had the issue on RN 0.74, reverting to rnmapbox/maps 10.1.27 solved the issue.
Thank you, you just saved me a LOT of headache. Granted it’s my own fault, I should’ve checked the issues earlier. I Thought It was something I did in my code. For now this is the best solution and can confirm works.
Here is my working setup for expo right now
Force the rnmapbox version to be
10.1.29or lower. This library raised the gradle target version so its no longer matching your RN gradle version.My workiing setup although I am using expo: