본문 바로가기
기술 개발/React-native

[error] Execution failed for task ':app:installDebug'.

by 쪼짱 2023. 3. 13.
728x90
반응형
SMALL
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unknown failure: cmd: Failure calling service package: Broken pipe (32)

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

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Unable to install C:\Users\user\fooddeliveryapp\front\android\app\build\outputs\apk\debug\app-debug.apk

잘 되던 빌드가 갑자기 안되더니 에뮬레이터가 아예 클릭조차 안된다

Execution failed for task ':app:installDebug'.

 

내가 시도해봤던 방법은 총 세 가지였다

1. npx react-native start --reset-cache

캐시 초기화 하기!

리액트 네이티브에서 사용하는 메트로 서버 캐시를 초기화해주는 것이다

이 방법은 빌드가 오래걸리거나 잘 안될 때 쓰는 방법 중 하나다

주로 빌드한 데이터가 남아있기 때문에 동작하지 않을 가능성이 있어서 초기화를 해주어야한다

 

2. cd android && gradlew clean

gradle 초기화하기!

cd android를 해서 android 파일로 들어간 다음,

gradlew clean 명령어를 실행시켜 gradle을 깨끗히 초기화해준다

 

위 두 가지 방법은 빌드가 안될 때 주로 사용하는 방법이라, 가끔씩 해주어도 된다

하지만, 이 방법으로도 빌드가 되지 않았다

마지막 세 번째 방법으로 이 문제를 해결하였다

 

3. 에뮬레이터 삭제 후 재설치

Failure calling service package: Broken pipe (32)

이런 에러가 있어서 검색해보니까 방법이 이 에뮬레이터를 삭제하는 방법이 있었다

방법은 간단하다

  • 안드로이드 스튜디오 열기
  • AVD Manager에서 앱을 실행 중인 기기를 선택한 후, 마우스 오른쪽을 눌러 삭제하기
  • create device 새로운 디바이스를 생성하기
  • 나열된 하드웨어 장치 목록에서 앱을 실행하려는 장치를 클릭하고 다운로드한 다음, 장치 생성을 완료하기 (이전에 설치를 했었기 때문에 설정 그대로 다운로드 받으면 됨)
  • 마지막으로 앱을 빌드 하고 새 디바이스 에서 실행하기

 

결국엔 마지막 방법으로 해결했지만, 가장 확실한 방법임에 틀림없는 것 같다


출처

https://medium.com/@abigail-edwin/solved-failure-calling-service-package-broken-pipe-32-3b860c7e04bb

 

 

728x90
반응형
LIST