maps
maps copied to clipboard
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 [email protected] 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'.
Yes same here ++
Force the rnmapbox version to be 10.1.29 or 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:
{
"react-native": "0.74.5",
"@rnmapbox/maps": "10.1.29",
}
same here, 10.1.29 doesnt solve the issue, ios is fine
same here, 10.1.29 doesnt solve the issue, ios is fine
![]()
Yea it looks like you are having a different issue than what op had
Hey folks, I'm having a similar issue:
Environment
Dev OS: Windows @rnmapbox/maps version: 10.1.29 React Native version: 0.74.3 Expo version: 51.0.23
Result running yarn android
> Task :rnmapbox_maps:compileDebugKotlin FAILED
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:212:5 'addView' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:227:5 'removeView' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:236:5 'removeAllViews' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:13:5 'getChildAt' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:17:5 'getChildCount' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:21:5 'addView' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:25:5 'removeViewAt' overrides nothing
e: file:///C:/Users/lucas/Documents/development/app/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.
Hey folks, I'm having a similar issue:
Environment
Dev OS: Windows @rnmapbox/maps version: 10.1.29 React Native version: 0.74.3 Expo version: 51.0.23
Result running yarn android
> Task :rnmapbox_maps:compileDebugKotlin FAILED e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:212:5 'addView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:227:5 'removeView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:236:5 'removeAllViews' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:13:5 'getChildAt' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:17:5 'getChildCount' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:21:5 'addView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:25:5 'removeViewAt' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/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.
Here is my working setup for expo right now
{
"expo": "~51.0.26",
"@rnmapbox/maps": "10.1.29",
"react-native": "0.74.5",
}
Hey folks, I'm having a similar issue:
Environment
Dev OS: Windows @rnmapbox/maps version: 10.1.29 React Native version: 0.74.3 Expo version: 51.0.23
Result running yarn android
> Task :rnmapbox_maps:compileDebugKotlin FAILED e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:212:5 'addView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:227:5 'removeView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/images/RNMBXImagesManager.kt:236:5 'removeAllViews' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:13:5 'getChildAt' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:17:5 'getChildCount' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:21:5 'addView' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSourceManager.kt:25:5 'removeViewAt' overrides nothing e: file:///C:/Users/lucas/Documents/development/app/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.Here is my working setup for expo right now
{ "expo": "~51.0.26", "@rnmapbox/maps": "10.1.29", "react-native": "0.74.5", }
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.
I also had the issue on RN 0.74, reverting to rnmapbox/maps 10.1.27 solved the issue.
@snowdamiz Thank you, reverting to "10.1.29" resolved the issue for me!
@TobiDevloft you can open the issue. I'll need to take a look, to see if we can make rnmapbox compatible with both RN<0.75 and >=0.75. In 10.1.30 I've made it compile with RN 0.75, but it sounds like this breaks with <=RN 0.74. At worst we'll need to provide patches so ppl can use the latest version with older react using patch-packages
Alright, reopening! Thanks for your work :)
I have the same problem, did you find a solution?
"react-native": "0.72.1", "@rnmapbox/maps": "10.1.29"
same:
"@rnmapbox/maps": "^10.1.28",
same:
"@rnmapbox/maps": "^10.1.28",
Remove the ^. What is your RN version?
same: "@rnmapbox/maps": "^10.1.28",
Remove the
^. What is your RN version?
I fixed by changing to:
https://github.com/rnmapbox/maps/issues/3598#issuecomment-2316145748
released v10.1.31-rc.0 this should work with RN 0.75, and 0.72 pls test
I still have this issue with v10.1.31-rc.0:
Task :rnmapbox_maps:compileDebugKotlin FAILED e: ResourceDrawableIdHelper.kt:5:37 Unresolved reference: Companion
ext.kotlinVersion = '1.9.21' [email protected] @rnmapbox/[email protected]
Just did another test with 0.72 but it still fails with rc.0:
npx react-native init MapboxTest --version 0.72.1
cd MapboxTest
yarn add @rnmapbox/[email protected]
# update android/build.grale with maven repo details
yarn android
> Task :rnmapbox_maps:compileDebugKotlin FAILED
45 actionable tasks: 45 executed
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/mattijs/Development/MapboxTest/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'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
@mfazekas
I think it's better for now to either not override ResourceDrawableIdHelper.getInstance and just use the deprecated ResourceDrawableIdHelper.getInstance in the codebase. Or create a
class ResourceDrawableIdHelperCompat {
companion object {
fun getInstance(): ResourceDrawableIdHelper {
return ResourceDrawableIdHelper.getInstance() // deprecated, .instance is preferred but can't be used on rn <0.75
}
}
}
and reference ResourceDrawableIdHelperCompat everywhere but it doesn't make much sense expect for have a single point for refactoring the accessor later on.
@mattijsf thanks, do you have new arch enabled? Not sure why I haven't seen this issue, while testing...
Sure we can remove getInstance override. I think a few RC's ago this was RN0.75 was not working without it. Sure we can live with deprecated.
@mattijsf thanks, do you have new arch enabled? Not sure why I haven't seen this issue, while testing... Sure we can remove
getInstanceoverride. I think a few RC's ago this was RN0.75 was not working without it. Sure we can live with deprecated.
I'm not using new arch. Just the instructions I wrote in https://github.com/rnmapbox/maps/issues/3598#issuecomment-2324118509 are enough. Maybe you hit some caching / node_modules situation where the build succeeded with the change 🤷
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:
{ "react-native": "0.74.5", "@rnmapbox/maps": "10.1.29", }
I am using the same version, but still failed
I still have this issue with v10.1.31-rc.0:
Task :rnmapbox_maps:compileDebugKotlin FAILED e: ResourceDrawableIdHelper.kt:5:37 Unresolved reference: Companion
ext.kotlinVersion = '1.9.21' [email protected] @rnmapbox/[email protected]
Just did another test with 0.72 but it still fails with rc.0:
npx react-native init MapboxTest --version 0.72.1 cd MapboxTest yarn add @rnmapbox/[email protected] # update android/build.grale with maven repo details yarn android> Task :rnmapbox_maps:compileDebugKotlin FAILED 45 actionable tasks: 45 executed 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/mattijs/Development/MapboxTest/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'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details
same here
It's unbelievable the amount of people that don't bother reading comments. Pure laziness 😂
Can you try with v10.1.31-rc.1 ?
released v10.1.31-rc.1 this should work with RN 0.75, and 0.72 pls test
I can confirm this is working for me
{
"react-native": "0.74.3",
"@rnmapbox/maps": "10.1.29",
}