react-native-maps: Execution failed for task ':react-native-maps:compileReleaseJavaWithJavac'.
Summary
hi I am having an issue. i am using react-native 0.72.3 library is compiling fine when building locally. but when i build for production, i get the following error:
Task :react-native-maps:compileReleaseJavaWithJavac FAILED /Users/vagrant/git/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:7: error: cannot find symbol import com.facebook.react.fabric.interop.UIBlockViewResolver; ^ symbol: class UIBlockViewResolver location: package com.facebook.react.fabric.interop /Users/vagrant/git/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:64: error: cannot find symbol interface UIBlockInterface extends UIBlock, com.facebook.react.fabric.interop.UIBlock {} ^ symbol: class UIBlock location: package com.facebook.react.fabric.interop /Users/vagrant/git/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:35: error: cannot find symbol public void execute(UIBlockViewResolver uiBlockViewResolver) { ^ symbol: class UIBlockViewResolver location: class MapUIBlock /Users/vagrant/git/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:39: error: cannot find symbol private void executeImpl(NativeViewHierarchyManager nvhm, UIBlockViewResolver uiBlockViewResolver) { ^ symbol: class UIBlockViewResolver location: class MapUIBlock /Users/vagrant/git/node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:56: error: cannot find symbol ((FabricUIManager) uiManager).addUIBlock(this); ^ symbol: method addUIBlock(MapUIBlock) location: class FabricUIManager 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. 5 errors FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:react-native-maps:compileReleaseJavaWithJavac’.
Compilation failed; see the compiler error output for 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. See https://docs.gradle.org/8.0/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 3m 32s 289 actionable tasks: 284 executed, 5 up-to-date Run: build task failed: exit status 1
i tried version .4 to today’s .6. still same error. any help will be appreciated.thanks
Reproducible sample code
<MapView
style={styles.map}
//specify our coordinates.
region={{
latitude: latitude,
longitude: longitude,
latitudeDelta: 0.0005,
longitudeDelta: 0.0005,
}}
>
{/*Make sure the Marker component is a child of MapView. Otherwise it won't render*/}
<Marker
coordinate={{
latitude: latitude,
longitude: longitude,
}}
pinColor={COLORS.BLUE}
onPress={() => {
showLocation({
latitude: latitude,
longitude: longitude,
});
}}
/>
</MapView>
Steps to reproduce
honestly i don’t know what specific steps, do i need to follow. i am just using bitrise to build and getting this error.
Expected result
suppose to compile the code without error
Actual result
compiling getting failed with error.
React Native Maps Version
1.15.4, 1.15.6
What platforms are you seeing the problem on?
Android
React Native Version
0.72.3
What version of Expo are you using?
Not using Expo
Device(s)
pixel 4
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 50
Remove the ^ mark from the package.json and don’t use the latest version.
“react-native-maps”: “1.15.3”,
for this version you will find it to be stable for android.
i have removed ^ sign from version and its works “react-native-maps”: “1.15.3”, thank you @cindyfelicia
try using 1.11.3. I was using this and it’s working well.
Everyone please don’t use the latest version of the library without the latest react-native.
There is often breaking changes, v1.13.2 and previous should be used if you’re not using react-native 0.74
Getting some errors on the MapUIBlock.java
The issue you’re facing occurs because react-native-maps requires additional configuration when building for a production APK. It works fine in the development environment (local), but for the APK, you need to configure the Google Maps SDK for Android. Here’s a detailed breakdown of the steps you need to follow:
1. Register a Google Cloud API Project
2. Create an API Key
3. Add the API Key to Your Project
"YOUR_GOOGLE_MAPS_API_KEY"with the actual API key you generated.4. Update
react-native-mapsto Use Google MapsPROVIDER_GOOGLEfromreact-native-mapsand pass it to theMapViewcomponent:5. Rebuild Your APK
6. Test the APK
7. Restrict the API Key (Optional but Recommended)
com.yourapp.name) and the SHA-1 certificate (if you plan to restrict it to a specific certificate).8. Rebuild and Test Again
By following these steps, you can successfully configure Google Maps for your React Native app without restricting the API key initially, and later add the restrictions for security if needed.
1.15.4works too, which is good, since it includes a fix for an issue which will soon block iOS App Store uploads.We’ll soon need at least
1.15.6due to the privacy issue on iOS: https://github.com/react-native-maps/react-native-maps/pull/5078i can confirm that i was able to build using 1.15.3. thank you for the help @kumVineet .
same issue using react native 0.73.0
I am using
"react-native": "0.73.2"with"react-native-maps": "1.14.0"removed^. it worksI have same issue with react native 0.73.8, even i have tried 1.15.3 but still i am getting same error
react-native: 0.73.6 react-native-maps: 1.15.4 worked for me for both platforms (previously react-native-maps: 1.20.0 was working only for iOS i downgraded to 1.15.4 and it worked for both)
It worked for me
@salah-ghanim not sure why this was close, a patch release has broken support, 1.15.3 works, 1.15.4 doesn’t. This is a true bug. Backward compatability should not be broken in a patch version release.
Yes this will also worked for me Thankyou
Try
1.13.2Looking at changelog, 1.15.4 should be ok. I tried and it works.