software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

Android not build with new architecture #3187

Closed AngelRmrz closed 3 weeks ago

AngelRmrz commented 3 weeks ago

Description

The build of the project fails, here is the output log on the terminal

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

Steps to reproduce

  1. Create a new project
  2. Install the library

Snack or a link to a repository

.

Gesture Handler version

2.20.2

React Native version

0.76.0

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Android emulator

Device model

Pixel 2XL

Acknowledgements

Yes

github-actions[bot] commented 3 weeks ago

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

github-actions[bot] commented 3 weeks ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

m-bert commented 3 weeks ago

Hi @AngelRmrz! Please provide complete logs. The ones you've shared do not point to Gesture Handler.

Also remember to prepare a reproduction. We've tested all configurations before releasing 2.20.2 so there shouldn't be any error with building project from Gesture Handler side.

edwinpcc commented 3 weeks ago

Same issue after upgradig to react-native v 0.76.0

Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
e: file:///F:/MyProject/node_modules/react-native-gesture-handler/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt:9:57 Unresolved reference: getEventDispatcher Note: F:\MyProject\node_modules\react-native-safe-area-context\android\src\paper\java\com\th3rdwave\safeareacontext\NativeSafeAreaContextSpec.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. FAILURE: Build failed with 
an exception. * What went wrong: Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more 
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. BUILD FAILED in 23s.
m-bert commented 3 weeks ago

@edwinpcc this has already been fixed in 2.20.2

AngelRmrz commented 3 weeks ago

This is more info about the error log, the log is even bigger, but i can't put all here, i already have the latest version

> Task :app:compileDebugKotlin FAILED

> Task :app:buildCMakeDebug[x86_64]
C/C++: ninja: Entering directory `/Users/angelrmrz/Developer/Work/DidactecaApp/android/app/.cxx/Debug/31682s5f/x86_64'
C/C++: /Users/angelrmrz/Developer/Work/DidactecaApp/node_modules/react-native-safe-area-context/android/build/generated/source/codegen/jni/react/renderer/components/safeareacontext/EventEmitters.cpp:16:69: warning: '$' in identifier [-Wdollar-in-identifier-extension]
C/C++: void RNCSafeAreaProviderEventEmitter::onInsetsChange(OnInsetsChange $event) const {
C/C++:                                                                     ^
C/C++: /Users/angelrmrz/Developer/Work/DidactecaApp/node_modules/react-native-safe-area-context/android/build/generated/source/codegen/jni/react/renderer/components/safeareacontext/EventEmitters.cpp:17:34: warning: '$' in identifier [-Wdollar-in-identifier-extension]
C/C++:   dispatchEvent("insetsChange", [$event=std::move($event)](jsi::Runtime &runtime) {
C/C++:                                  ^
C/C++: /Users/angelrmrz/Developer/Work/DidactecaApp/node_modules/react-native-safe-area-context/android/build/generated/source/codegen/jni/react/renderer/components/safeareacontext/EventEmitters.cpp:17:51: warning: '$' in identifier [-Wdollar-in-identifier-extension]
C/C++:   dispatchEvent("insetsChange", [$event=std::move($event)](jsi::Runtime &runtime) {
C/C++:                                                   ^
C/C++: /Users/angelrmrz/Developer/Work/DidactecaApp/node_modules/react-native-safe-area-context/android/build/generated/source/codegen/jni/react/renderer/components/safeareacontext/EventEmitters.cpp:18:10: warning: '$' in identifier [-Wdollar-in-identifier-extension]
C/C++:     auto $payload = jsi::Object(runtime);
C/C++:          ^

I've follow the guide for installation on the official docs, here is my package.json file

    "@react-native-masked-view/masked-view": "^0.3.1",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/stack": "^6.4.1",
    "babel-plugin-module-resolver": "^5.0.2",
    "react": "18.3.1",
    "react-native": "0.76.0",
    "react-native-dotenv": "^3.4.11",
    "react-native-gesture-handler": "^2.20.2",
    "react-native-safe-area-context": "^4.12.0",
    "react-native-screens": "^3.35.0"

It still doesn't run on android device simulator.

m-bert commented 3 weeks ago

All of those logs point to react-native-safe-area-context, not to Gesture Handler, so there's not much that we can do.