React-Native: The number of method references in a .dex file cannot exceed 64k API 17 error

Maliethy·2021년 2월 28일
0

React-Native Error

목록 보기
8/15
post-custom-banner

1. error

rn프로젝트에서 android를 빌드하는 도중 Execution failed for task ':app:mergeDexDebug'가 발생했다.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* 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 38s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\user\momo\wellwork\front\node_modules\@react-native-firebase\auth\android\src\main\java\io\invertase\firebase\auth\ReactNativeFirebaseAuthModule.java uses or overrides a deprecated API.

2. solution

The number of method references in a .dex file cannot exceed 64k API 17

android/app/build.gradle에서 다음과 같이 multiDexEnabled를 true로 설정한다.


defaultConfig {
    applicationId "com.front_rn"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
profile
바꿀 수 있는 것에 주목하자
post-custom-banner

0개의 댓글