React Native/React Native_error

[React Native] Execution failed for task ':app:mergeLibDexDebug'.

bocoder
728x90
반응형

* Firebase SDK를 연동하는 과정에서 라이브러리가 많다보니 메모리가 충족되지 않아 발생하는 문제였음

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeLibDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
         > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

 

아래 설정을 통해 해결 가능함

 

# android/app/build.gradle

android {
	...
    defaultConfig {
    	...
        
        multiDexEnabled true    // add here
    }
    ...
   
    dependencies {
    ...

    implementation 'androidx.multidex:multidex:2.0.1'    // add here
    }    
}

 

* 메모리 heap size 늘리기

# android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="kr.co.bocoder.findanimal">
    <uses-permission android:name="android.permission.INTERNET" />
    <application
      ...
      
      android:largeHeap="true"     // add here
      >
      ...
    </application>
</manifest>

 

# android/gradle.properties

...

org.gradle.jvmargs=-Xmx4608m

 

-------------

 

나의 경우 위와 같이 했는데도 동일하게 발생했다..

원인은 firebase 모듈을 @react-native-firebase/app 및 react-native-firebase 를 모두 설치해서 발생한 오류였고,

@react-native-firebase/app 를 삭제하면서 해결

 

* refered : https://github.com/invertase/react-native-firebase/issues/2561#issuecomment-529946852

 

728x90
반응형