Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Flutter to update my version and build number?

  1. I've changed my version in pubspec.yaml to 1.0.1+1 (from 1.0.0+3)
  2. flutter clean
  3. flutter build ios
  4. When I open [project]/ios/Runner.xcworkspace it still shows me 1.0.0 version.

What am I doing wrong? How can I force Xcode to update my version from CLI or pubspec.yaml?

This is how my Info.plist looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>Name</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Sundee</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Your location will be used to determine sun angle.</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>
like image 842
Tomas Baran Avatar asked May 20 '20 21:05

Tomas Baran


People also ask

How do I find my app version in Flutter?

app_version 0.0. This is a Flutter widget that checks and displays the version status of application and you can easily guide user to update your app. A most easily usable Flutter widget about application version check!

How do I update my flutter SDK?

To update the Flutter SDK use the flutter upgrade command: This command gets the most recent version of the Flutter SDK that’s available on your current Flutter channel. If you want an even more recent version of the Flutter SDK, switch to a less stable Flutter channel and then run flutter upgrade.

How to override the version and builder number in flutter build?

Both the version and the builder number may be overridden in flutter build by specifying --build-name and --build-number, respectively. Read more about versioning at semver.org.

What happens when you change the state of a flutter application?

If it identifies any data change, it will rebuild its widgets, and set the new data to the current widget tree. This way, Flutter will redraw its UI and display the current state of your application. Changing a state in the Flutter will always cause the UI to rebuild itself. However, this case is not always one hundred percent effective.

How to rebuild a flutter widget when flutter fails to set theme?

The themeMode property will cause a full rebuild of the application to conform with the specified theme as seen above. Congratulations! You can now rebuild a widget even when Flutter fails to do so. Flutter uses setState() to reference the state object and identify any change to the state.


2 Answers

The same thing happened to me.

I think that when I used the xcode interface he changed the file ios/Runner.xcodeproj/project.pbxproj and he didn't get the value automatically

I solved it like this.

change this:

CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version

to:

CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";

this appears 3 times

like image 50
Elvis Teles Avatar answered Sep 30 '22 15:09

Elvis Teles


I got it. It's because my lines in my Info.plist did not look like the following:

    <key>CFBundleShortVersionString</key>     
    <string>$(FLUTTER_BUILD_NAME)</string> 
    <key>CFBundleVersion</key> 
    <string>$(FLUTTER_BUILD_NUMBER)</string>

Anyone has an idea why I had $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION)?

like image 41
Tomas Baran Avatar answered Sep 30 '22 16:09

Tomas Baran