안드로이드 가상 디바이스 (AVD) 터미널로 실행하기

2022. 1. 27. 00:08Dev Tools

Introduction

최근에 모바일 자동화 스크립트를 CI/CD에 연결해서 내부 테스트 빌드가 배포되면 자동으로 로그인 테스트 수행시켜보려고, emulator로 테스트를 수행하게 스크립를 수정하고 있다. 

막연히 Emulator는 실제 디바이스 보다 쉽겠지..생각하고, 공식문서를 보는데 역시나 이해도 안되고, 에러도 많이 발생했다. 

하루 정도 삽질을 하고 나서야 AVD를 에러 없이 작동시킬 수 있게 되었다... 


미래에 또 삽질하게 될 나를 위해서, 회사에서 간단하게 문서로 정리해 보았다. 나 처럼 삽질하시는 분이 있으시리라 생각이 들어서 블로그에 업로드 해보려고 한다. 오늘은 많이 피곤하므로, 우선 기존에 작성한 문서를 그대로 붙여넣고, 나중에 필요하면 한국어로 수정하도록 해야겠다.

 

 

Getting Started

 

1. Android Studio Installation

Let’s go to Android Studio Download and install Android Studio. After that, apply the following steps. Click the “Next” icons and finally click the “Finish“.

2. Start Emulator

a. Press ‘/More Actions/AVD Manager'

 

  b. Press ‘Actions’

c. AVD will start ...

 

 

Command Line

  • Check connected devices
adb devices //show connected devices
  • Emulator device lists
emulator -list-avds
  • Run emulator in terminal
cd path/to/emulator // change directory to emulator
./emulator -avd{emulator name}  //run emulator
  • Install .apk file to emulator in terminal
 
adb -e install path/to/app.apk

/*
-d                        - directs command to the only connected USB device...
-e                        - directs command to the only running emulator...
-s <serial number>        ...
-p <product name or path> ...
*/

 

TroubleShoot

 

  1. Emulator only shows a Black screen or Emulator is not working

    > Wipe Data from Android Studio

 

2. not enough space for installing apk file

android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)

 

> Increase Memory and Storage

 

 

Link: https://stackoverflow.com/questions/3480201/how-do-you-install-an-apk-file-in-the-android-emulator

 

How do you install an APK file in the Android emulator?

I finally managed to obfuscate my Android application, now I want to test it by installing the APK file and running it on the emulator. How can I install an APK f...

stackoverflow.com