본문 바로가기
프로그래밍/Flutter <Dart>

[Flutter] 안드로이드 배포 시 프로젝트 버전 수정하기

by TaeGyeong Lee 2025. 1. 12.

개요 

플레이 스토어에 앱을 업데이트하기 위해서는 새로운 프로젝트 버전의 앱 번들을 업로드해야 합니다. 이 글에선 플러터 프로젝트를 안드로이드 앱으로 빌드, 배포 시 프로젝트 버전을 수정하는 법을 안내합니다. 

 

pubsec.yaml

프로젝트 루트디렉토리에 위치한 pubsec.yaml 파일을 찾아 version 을 수정합니다. 

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+2

version 은 version number+build number 형태로 구성되는데, 위의 예에선 

  • version number : 1.0.0
  • build number : 2

입니다. 

 

안드로이드 플랫폼은 버전의 정보를 Version number와 Version Code 두 가지 정보를 통해 관리합니다.

  • Version Number : 문자열 형태로 사용자가 확인 가능한 버전입니다. 예) "1.4.3" 
  • Version Code : 양의 정수로, 사용자가 아닌 시스템이 앱의 버전을 확인할 때 실질적으로 활용되는 값입니다. 예) 18 

 

플러터 프로젝트에서 Version number 는 안드로이드 플랫폼에서 version Number와, build Number는 Version Code 역할을 하게 됩니다. 

따라서, 새로운 버전으로 업그레이드 할 때 가장 중요한 부분은, Build Number (Version Code) 를 반드시 이전 앱에서 사용하지 않은 양의 정수로 변경해 주어야 합니다.

Version Number는 변경할 필요는 없지만, 사용자에게 보여지기에 이 또한 팀에서 규정한 버전 관리 규칙에 따라 변경해 주는 것이 좋습니다. 버전 관리 규칙에 대해선 이 글을 참조하세요. 

 

참고 자료