[Flutter] 개발 중 안드로이드 iOS 시뮬레이터를 동시에 보려면

Flutter 기본 디버그 설정으로는 한번에 안드로이드와 아이폰 에뮬레이터를 볼 수 없습니다. 한번에 한 기기에만 연결이 되기 때문입니다

[Flutter] 개발 중 안드로이드 iOS 시뮬레이터를 동시에 보려면
같은 코드 / 다른 결과

Flutter 기본 디버그 설정으로는 한번에 안드로이드와 아이폰 에뮬레이터를 볼 수 없습니다. 한번에 한 기기에만 연결이 되기 때문입니다

위 시뮬레이터에 HELLO WORLD를 보여주는 코드는 아래와 같습니다.@override
Widget build(BuildContext context) {
 return Container(
   color: Colors.white,
   child: Center(
     child: Text('HELLO WORLD'),
   ),
 );
}

이같은 문제를 해결하기 위해 두 플랫폼의 에뮬레이터를 동시에 켜서 작업하는 것이 필요합니다.

비주얼 스튜디오 코드의 디버그 설정에 다음과 같이 설정하면 두 에뮬레이터를 동시에 켤 수 있습니다.{
 // Use IntelliSense to learn about possible attributes.
 // Hover to view descriptions of existing attributes.
 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
 "version": "0.2.0",
 "configurations": [
   {
     "name": "Current Device",
     "request": "launch",
     "type": "dart"
   },
   {
     "name": "Android",
     "request": "launch",
     "type": "dart",
     "deviceId": "android"
   },
   {
     "name": "iPhone",
     "request": "launch",
     "type": "dart",
     "deviceId": "iphone"
   },
 ],
 "compounds": [
   {
     "name": "All Devices",
     "configurations": [
       "Android",
       "iPhone"
     ],
   }
 ]
}

launch.json을 저장하면 디버그 탭의 디버그 실행 메뉴가 변경된 것을 볼 수 있습니다.

두 에뮬레이터를 켜고 All Devices를 누르면 앱의 변경사항을 동시에 확인할 수 있습니다.

시리즈의 전체목록을 보려면 링크를 눌러주세요

Subscribe to Half-Built Life

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe