mkuczera / react-native-haptic-feedback

React-Native Haptic Feedback for iOS with Android similar behaviour.
MIT License
855 stars 103 forks source link

Build issue - Execution failed for task ':react-native-haptic-feedback:compileDebugJavaWithJavac'. #112

Closed BrianJVarley closed 11 months ago

BrianJVarley commented 1 year ago

Hey @mkuczera, I've just installed "react-native-haptic-feedback": "2.1.0" in a "react-native": "^0.72.3" project. But running an android build - ./gradlew assembleDebug, results in this error below in the class RNReactNativeHapticFeedbackPackage on this line in the getReactModuleInfoProvider function.

I notice one difference in your package source as it uses gradle-7.0.2-bin whereas my project uses gradle-8.0.1-all. But I couldn't downgrade to 7.0.2 since my project relies on newer gradle configuration.

It seems like the compiler doesn't recognise the Map - cannot find the symbol "Map" in the context of the code

Can you help in any way to resolve this build issue?
Or if version 2.1.0 is compatible with react-native@0.72.3?

Error log out from ./gradlew assembleDebug command:

> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Android gradle plugin: 7.4.2
Gradle: 8.0.1
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Task :react-native-haptic-feedback:compileDebugJavaWithJavac FAILED
/Users/brianvarley/Projects/react-native-prototyping/node_modules/react-native-haptic-feedback/android/src/main/java/com/mkuczera/RNReactNativeHapticFeedbackPackage.java:29: error: cannot find symbol
            final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
                  ^
  symbol:   class Map
  location: class RNReactNativeHapticFeedbackPackage

I've added some details about my package.json dependencies, node and java versions below:

java@11.0.19 node@v16.10.0

 "dependencies": {
    "@mgcrea/react-native-dnd": "^1.4.0",
    "bluebird": "^3.7.2",
    "convert-units": "^2.3.4",
    "event-emitter": "^0.3.5",
    "fbjs": "^3.0.5",
    "npm": "^9.8.1",
    "prop-types": "^15.8.1",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "^0.72.3",
    "react-native-cli": "^2.0.1",
    "react-native-config": "^1.5.1",
    "react-native-gesture-handler": "2.9.0",
    "react-native-haptic-feedback": "2.1.0",
    "react-native-svg": "^13.10.0",
  },
jerrynim commented 1 year ago

same error node_modules/react-native-haptic-feedback/android/src/main/java/com/mkuczera/RNReactNativeHapticFeedbackPackage.java:29: error: cannot find symbol final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();

        "react-native-haptic-feedback": "^2.0.3"
        "react": "18.2.0",
        "react-native": "0.71.10",
BrianJVarley commented 12 months ago

@mkuczera, On stackoverflow @rajaasim found a fix for this bug with the following commit -> https://github.com/rajaasim/react-native-haptic-feedback/commit/efc35247f47c9cee6d4f1ca792838adefd37cd78, the import java.util.Map; was missing in RNReactNativeHapticFeedbackPackage. Could this be patched?

mkuczera commented 12 months ago

@BrianJVarley sure, will patch everything on this weekend

BrianJVarley commented 11 months ago

Hey @mkuczera there is a PR already open for review here --> https://github.com/mkuczera/react-native-haptic-feedback/pull/113

relaxxpls commented 11 months ago

@mkuczera did you get a chance to solve this?

mkuczera commented 11 months ago

Fixed in Release 2.1.0 / 2.2.0 I deprecated the failure releases. Sorry for the issues.