[ReactNative] Android 빌드중 v2.14.1 and RN 0.71.0 (Android) Could not get unknown property 'hermesEnabled' for project ':app' of type org.gradle.api.Project. 오류 발생시 해결방법

성 우·2023년 7월 31일
0

React-Native

목록 보기
3/4

react-native-reanimated 에 올라온 이슈
https://github.com/software-mansion/react-native-reanimated/issues/3959


빌드시 아래와같이 뜨시는분들은 모두 해결이 가능한 방법인듯

Where: Build file 'D:\Projects\Vow\iye_react_native_user_app\node_modules\react-native-reanimated\android\build.gradle' line: 152

What went wrong: A problem occurred evaluating project ':react-native-reanimated'.
After upgrading to 2.14.4 - Could not get unknown property 'hermesEnabled' for project ':app' of type org.gradle.api.Project
* where: build file '/users/mypc/directory/node_modules/react-native-reanimated/android/build.gradle' line: 246

참고로 나는 3번째에 출력되는 로그가 발생했었다.


해결방법

이슈 내용은 reanimated 패키지와 리액트 0.70.0 이상 버전에서 나타나는 이슈로 확인된다.

해결방법은 node_modules에 설치된 react-native-reanimated/android 폴더에 있는 build.gradle 에서 아래와같이 수정하면된다.

아래 명령어로 node_module의 관리자권한을 부여해서 node_module를 수정했음.

chomod -R 777 node_module/react-native-reanimated/android

// Check if Hermes is enabled in app setup
    def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
    if ((REACT_NATIVE_MINOR_VERSION >= 71 && appProject?.hermesEnabled?.toBoolean()) || appProject?.ext?.react?.enableHermes?.toBoolean()) {
        return "hermes"
	}

아래코드로 변경해주면 정상적으로 빌드된다.


// Check if Hermes is enabled in app setup
 def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
    if ((REACT_NATIVE_MINOR_VERSION >= 71) || appProject?.ext?.react?.enableHermes?.toBoolean()) {
     return "hermes"
 }

Fix pull request 링크

https://github.com/codewithmecoder/react-native-reanimated/commit/37ff277a9a2dc2c1c3c967a42ddc7089ca952933

profile
풀스택 개발자가 되고싶은 개발자

0개의 댓글