Repository navigation
"buildNumber" is incorrect #37320
Description
Activity
Can you paste your pubspec.yaml and
flutter doctor -v?- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 31, 2019 pubspec.ymal:
name:
description: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 used as CFBundleVersion.
Read more about iOS versioning at
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2020.0+3131
environment:
sdk: ">=2.1.0 <3.0.0"dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
shared_preferences: ^0.5.2 # https://pub.dev/packages/shared_preferences (BSD license)
http: ^0.12.0 # https://pub.dev/packages/http (BSD license)
tuple: ^1.0.2 # https://pub.dev/packages/tuple (BSD license)
transparent_image: ^1.0.0 # https://pub.dev/packages/transparent_image (MIT license)
intl: ^0.15.8 # https://pub.dev/packages/intl (BSD license)
#zoomable_image: ^1.3.1 # https://pub.dev/packages/zoomable_image (ISC license)
photo_view: ^0.4.0 # https://pub.dev/packages/photo_view (MIT license)
audioplayers: ^0.12.0 # https://pub.dev/packages/audioplayers (MIT license)
bordered_text: ^0.1.2 # https://pub.dev/packages/bordered_text (MIT license)
web_socket_channel: ^1.0.13 # https://pub.dev/packages/web_socket_channel (BSD license)
package_info: ^0.4.0 # https://pub.dev/packages/package_info (BSD license)
#flutter_advanced_networkimage: ^0.4.15 # https://pub.dev/packages/flutter_advanced_networkimage (MIT license)The following adds the Cupertino Icons font to your application.
Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2 # https://pub.dev/packages/cupertino_icons (MIT license)
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.2 # https://pub.dev/packages/flutter_launcher_icons (MIT license)flutter packages pub run flutter_launcher_icons:main
flutter_icons:
ios: false
android: true
image_path: "assets/images/app_icon.png"For information on the generic Dart part of this file, see the
following page: https://www.dartlang.org/tools/pub/pubspec
The following section is specific to Flutter.
flutter:
The following line ensures that the Material Icons font is
included with your application, so that you can use the icons in
the material Icons class.
uses-material-design: true
To add assets to your application, add an assets section, like this:
assets:
- assets/images/
#- assets/certs/
- assets/sounds/An image asset can refer to one or more resolution-specific "variants", see
https://flutter.dev/assets-and-images/#resolution-aware.
For details regarding adding assets from package dependencies, see
https://flutter.dev/assets-and-images/#from-packages
To add custom fonts to your application, add a fonts section here,
in this "flutter" section. Each entry in this list should have a
"family" key with the font family name, and a "fonts" key with a
list giving the asset and other descriptors for the font. For
example:
fonts:
- family: Schyler
fonts:
- asset: fonts/Schyler-Regular.ttf
- asset: fonts/Schyler-Italic.ttf
style: italic
- family: Trajan Pro
fonts:
- asset: fonts/TrajanPro.ttf
- asset: fonts/TrajanPro_Bold.ttf
weight: 700
For details regarding fonts from package dependencies,
see https://flutter.dev/custom-fonts/#from-packages
flutter doctor -v:
λ flutter doctor -v
[√] Flutter (Channel master, v1.8.2-pre.181, on Microsoft Windows [Version 10.0.17134.254], locale en-US)
• Flutter version 1.8.2-pre.181 at M:\Flutter\flutter_sdk
• Framework revision c15cfdd (7 days ago), 2019-07-24 22:44:12 -0700
• Engine revision 72341ed
• Dart version 2.5.0 (build 2.5.0-dev.1.0 0c97c31b6e)[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at Y:\Dev\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = Y:\Dev\Android\Sdk
• Java binary at: D:\AndroidStudio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.[√] Android Studio (version 3.4)
• Android Studio at D:\AndroidStudio
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)• No issues found!
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Jul 31, 2019 Additional observations:
This seems to only happen only with a "release" build. In Android Studio/Emulator, it correctly reports "3131" with the debug build. From the command line, building directly using Flutter in "release" and running the "app-beta-armeabi-v7a-release.apk" file on a phone displays "4131".
Ok, this may not be package_info at fault. Installing on the phone displays "2020.0-beta(4131)" in the dialog prompting for permission to install the APK. I'm guessing the information displayed in this dialog would not be coming from the Flutter (package_info) code itself, but from some Android-specific configuration files compiled with it.
This may be Flutter (or gradle) at fault.
I'm going to assume that this is some other system at fault--Flutter, gradle, or the Android version on the phone I'm testing with (6.0.1). If I have better evidence that package_info is involved, I'll re-open.
Sorry for the bother.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Aug 29, 2021
I have the following code in my Flutter project:
PackageInfo.fromPlatform().then((PackageInfo packageInfo) { appName = packageInfo.appName; packageName = packageInfo.packageName; version = packageInfo.version; buildNumber = packageInfo.buildNumber; });The
versionandbuildNumbervalues are being set directly in the pubspec.yaml file as:version: 2020.0+3131But the Flutter code is returning "4131" for the
buildNumberinstead of "3131". I have also tried passing these values on the command line instead of manually modifying pubspec.yaml (using "--build-name" and "--build-number") with the same result.I'm using version 0.4.0+6 of package_info.