크로스 플랫폼/React-Native <JSX>

[React-Native] android gradle Configuration with name 'compile' not found. 에러 해결

TaeGyeong Lee 2023. 6. 24. 14:39

발생 에러

FAILURE: Build failed with an exception.

* What went wrong:
Configuration with name 'compile' not found.

* 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

 

해결 방법

이 글에서 제시하는 방법은 빌드 시 사용하는 gradle 버전이 7 이상일 상황에 한합니다.

프로젝트/android 디렉토리를 안드로이드 스튜디어로 열어 build.gradle (Project) 파일을 수정해 주세요. copyDownloadableDepsToLibs 내 compile 을 implementaion으로 변경해 주세요. gradle sync 후 재빌드 해보세요.

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation // compile에서 implementation으로 변경
    into 'libs'
}

 

에러 발생 원인

gradle 7 부터 compile configurations을 지원하지 않습니다. compile -> implementation 으로 이름이 변경되었습니다. 주로 구버전 React-native 프로젝트에서 gradle 업그레이드 후 빌드 과정 중에 발생할 수 있는 문제입니다.

https://docs.gradle.org/current/userguide/upgrading_version_6.html#sec:configuration_removal