기록하다

[오류해결] Execution failed for task ':app:mergeDebugNativeLibs'.

메슈어 2022. 5. 30. 13:15

 

BUILD FAILED in 1m 15s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
      - C:\Users\snippet\.gradle\caches\transforms-3\7d9d92dc8ec1ba2e45aff2ecbb549550\transformed\jetified-react-native-0.68.2\jni\arm64-v8a\libc++_shared.so
      - C:\Users\snippet\.gradle\caches\transforms-3\acf3dc10d363969ea213ba5fafddbcd7\transformed\jetified-PdfiumAndroid-1.0.1\jni\arm64-v8a\libc++_shared.so
* 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 1m 15s

    at makeError (C:\projects\react_native\TodoApp\node_modules\execa\index.js:174:9)
    at C:\projects\react_native\TodoApp\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\projects\react_native\TodoApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\projects\react_native\TodoApp\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

(발생한 오류 내용)

 

Execution failed for task ':app:mergeDebugNativeLibs'. in react native

 

 

Execution failed for task ':app:mergeDebugNativeLibs'. in react native

I installed react-native-pdf and now when I run "npx react-native run-android", it fails with the following: * What went wrong: Execution failed for task ':app:mergeDebugNativeLibs'. > A

stackoverflow.com

 

 

요즘 리엑트 네이티브 공부중인데, 어느날 갑자기 빌드가 안되어서 검색해봤다. 

어떤 블로거는 캐쉬삭제만 해도 다시 빌드가 잘 되었다고는 하던데,, 나는 안되더라.

위에 링크해둔 방법대로 해서 해결되었다. 

위 방법을 요약하자면, 

1. 프로젝트 폴더 내 android 폴더로 이동 후 

2. 아래 명령어를 실행해서 캐쉬를 삭제한다.

./gradlew cleanBuildCache

 

3. android/app/ 경로의 build.gradle 파일을 찾아서 에디터로 열고, 

아래 내용을 붙여넣기 한다. (packagingOptions 추가)

android {

packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
    pickFirst 'lib/x86_64/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
}

/** rest of your code here **/

 

그리고는 빌드 !

npx react-native run-android

 

이 글을 검색해보신 분들의 성공을 기원합니다!