react-native-maps: Task :react-native-maps:compileReleaseJavaWithJavac FAILED

Summary

When building React Native 0.70 for Android, it fails with the error:

./node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:7: error: package com.facebook.react.fabric.interop does not exist
import com.facebook.react.fabric.interop.UIBlockViewResolver;
                                        ^
./node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java:64: error: package com.facebook.react.fabric.interop does not exist
interface UIBlockInterface extends UIBlock, com.facebook.react.fabric.interop.UIBlock  {}
                                                                             ^
./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
./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
./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

This may be related to #5061, which was released in v1.15.5. Was this intended to be a breaking change?

Reproducible sample code

N/A

Steps to reproduce

Install deps:

yarn add react-native-maps react-native@0.70

Build for Android:

react-native run-android --variant=release

Expected result

Android build success

Actual result

Android build error

React Native Maps Version

1.15.6

What platforms are you seeing the problem on?

Android

React Native Version

0.70.15

What version of Expo are you using?

Not using Expo

Device(s)

Android

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (1 by maintainers)

Most upvoted comments

I resolved an issue using the following setup:

Note:If you are using react-native-reanimated, first check out this link: _https://github.com/software-mansion/react-native-reanimated/issues/6076#issuecomment-2154224601_

React Native version: 0.72.3 react-native-maps version: 1.15.6

The solution involves replacing the MapUIBlock.java file located at node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java

Here’s the code to use in MapUIBlock.java:

package com.rnmaps.maps;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.UIManagerModule;

import java.util.function.Function;

public class MapUIBlock implements UIBlock {
    private int tag;
    private Promise promise;
    private ReactApplicationContext context;
    private Function<MapView, Void> mapOperation;

    public MapUIBlock(int tag, Promise promise, ReactApplicationContext context, Function<MapView, Void> mapOperation) {
        this.tag = tag;
        this.promise = promise;
        this.context = context;
        this.mapOperation = mapOperation;
    }

    @Override
    public void execute(NativeViewHierarchyManager nvhm) {
        MapView view = (MapView) nvhm.resolveView(tag);
        if (view == null) {
            promise.reject("AirMapView not found");
            return;
        }
        if (view.map == null) {
            promise.reject("AirMapView.map is not valid");
            return;
        }

        mapOperation.apply(view);
    }

    public void addToUIManager() {
        UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
        uiManager.addUIBlock(this);
    }
}

Hello guys there is an something went wrong with Latest Version i change my Maps version 1.15.6 -> 1.14.0 and than clean the build and run again it’s works for me.

Screenshot 2024-06-19 at 3 41 56 PM

here’s what I did to get this working again:

  • Locked the package version to 1.15.4
  • Ran npm install
  • Navigated to the Android folder and ran ./gradlew clean && ./gradlew bundleRelease

Exactly. Version 1.14.0 and not ˆ1.14.0 worked for me.

@yogeshBadgujar7 Downgrading from 1.15.6 to 1.14.0 worked for me.

I resolved an issue using the following setup:

Note:If you are using react-native-reanimated, first check out this link: software-mansion/react-native-reanimated#6076 (comment)

React Native version: 0.72.3 react-native-maps version: 1.15.6

The solution involves replacing the MapUIBlock.java file located at node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java

Here’s the code to use in MapUIBlock.java:

package com.rnmaps.maps;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.UIManagerModule;

import java.util.function.Function;

public class MapUIBlock implements UIBlock {
    private int tag;
    private Promise promise;
    private ReactApplicationContext context;
    private Function<MapView, Void> mapOperation;

    public MapUIBlock(int tag, Promise promise, ReactApplicationContext context, Function<MapView, Void> mapOperation) {
        this.tag = tag;
        this.promise = promise;
        this.context = context;
        this.mapOperation = mapOperation;
    }

    @Override
    public void execute(NativeViewHierarchyManager nvhm) {
        MapView view = (MapView) nvhm.resolveView(tag);
        if (view == null) {
            promise.reject("AirMapView not found");
            return;
        }
        if (view.map == null) {
            promise.reject("AirMapView.map is not valid");
            return;
        }

        mapOperation.apply(view);
    }

    public void addToUIManager() {
        UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
        uiManager.addUIBlock(this);
    }
}

WELDONE BRO. It saved my life , you are a super hero.😍✌

I resolved an issue using the following setup:

Note:If you are using react-native-reanimated, first check out this link: software-mansion/react-native-reanimated#6076 (comment)

React Native version: 0.72.3 react-native-maps version: 1.15.6

The solution involves replacing the MapUIBlock.java file located at node_modules/react-native-maps/android/src/main/java/com/rnmaps/maps/MapUIBlock.java

Here’s the code to use in MapUIBlock.java:

package com.rnmaps.maps;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.UIManagerModule;

import java.util.function.Function;

public class MapUIBlock implements UIBlock {
    private int tag;
    private Promise promise;
    private ReactApplicationContext context;
    private Function<MapView, Void> mapOperation;

    public MapUIBlock(int tag, Promise promise, ReactApplicationContext context, Function<MapView, Void> mapOperation) {
        this.tag = tag;
        this.promise = promise;
        this.context = context;
        this.mapOperation = mapOperation;
    }

    @Override
    public void execute(NativeViewHierarchyManager nvhm) {
        MapView view = (MapView) nvhm.resolveView(tag);
        if (view == null) {
            promise.reject("AirMapView not found");
            return;
        }
        if (view.map == null) {
            promise.reject("AirMapView.map is not valid");
            return;
        }

        mapOperation.apply(view);
    }

    public void addToUIManager() {
        UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
        uiManager.addUIBlock(this);
    }
}

Thanks bro, this code running for my react-native: 0.72.7 - react-native-maps: 1.14.0

Same error is coming. My react native version is 0.73.9 any update on this

Same error is coming. My react native version is 0.73.8 and maps version 1.14.0 and 1.15.4 and it doesn’t work when ues does it. how is it slove

if you use nvm, change version to 1.14.0 then before “yarn install” make “nvm cache clear”

Sadly, the patch version is as a major version change https://github.com/react-native-maps/react-native-maps/issues/5082 and project does not use peerDependencies properly

I just updated the documentations to make this clear compatibility

you need react-native 0.74 and above if you’re using any react-native-maps version above 1.4.0

@Usmanqayyum109 OMG…👍 👀