Can my Flutter project have a different version number for Android and iOS? - flutter

Is it possible to use pubspec and the flutter build tools to create release versions of my app with a different version for each platform? Eg iOS could be 1.0.1+10 and Android 5.2.3?
This is wrong but I'm thinking something like like the below
name: myapp
description: my app description
ios_version: 1.0.1+10
android_version: 5.2.3
Currently the apps in the stores have different version numbers. Would we need to bump them both to the same version, say 6.0.0? Is it possible to have a pubspec for each version?

For iOS find the file name Generated.xcconfig and change the following parameter
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
Otherwise, default version getting from pubspec.yaml from the following line :
version: 1.0.0+1 // default version set

For Andriod edit the local.properties file inside android folder when you are building.
For iOS edit the Generated.xcconfig file inside ios/FLutter folder or update from Xcode when you are building.
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1

Related

Bitrise flutter build keeps using older versions of flutter/dart

I have a flutter app that I am trying to build through bitrise.
I keep getting a tonne of errors along the lines of
Error: The 'super-parameters' language feature is disabled for this library.
Try removing the package language version or setting the language version to 2.17 or higher.
super.key
and it is blocking me from analyzing and building the app.
Now the issue is, I am using flutter install with upgrade set to true , and have sdk target in my pubspec.yaml as
Environment:
sdk: ">=2.17.6 <3.0.0"
I disabled the caching steps, and tried to create a new deployment pipeline, to no avail.
In your workflow, add Flutter Install, Then set your desired flutter version on Input Variables sections's Flutter SDK git repository version field. e.g. 2.8.0.

How to use a specific version of flutter for build apk, when i have 2 version of flutter install?

So i am installing both version of flutter, version 2 and, 1.22.6 , i want to build apk for my 1.22.6 project, but flutter automatically call the version 2 for building apk, this create error, what should i do?
Try using this Flutter version manager
You can create alias for Flutter and point to different version
for example
flutter will call flutter 1.22.6
flutterd will call flutter 2 instead
so when you want to build for 1.22.6 just use flutter
I have write a article, sadly in Thai not translate yet, how to have 2 different version of Flutter and how to make alias to call different version here
https://medium.com/kbtg-life/%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%88%E0%B8%B1%E0%B8%81-flutter-2-0-%E0%B8%81%E0%B8%B1%E0%B8%99%E0%B8%A3%E0%B8%B6%E0%B8%A2%E0%B8%B1%E0%B8%87-%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7%E0%B8%97%E0%B8%B3%E0%B8%A2%E0%B8%B1%E0%B8%87%E0%B9%84%E0%B8%87%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B9%80%E0%B8%84%E0%B8%A3%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B8%A1%E0%B8%B5%E0%B8%97%E0%B8%B1%E0%B9%89%E0%B8%87-2-%E0%B9%80%E0%B8%A7%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%8A%E0%B8%B1%E0%B8%99-de861c810d57?source=your_stories_page-------------------------------------
so after you this, you can just run
flutter build
I also faced same problem in the past. So what I did was, I downloaded both versions of flutter say (flutter2.2 and flutter1.22). And I have kept them in same folder. Now if I want to use flutter 2.2 then I'll rename "flutter2.2" folder to "flutter" and If I want to use flutter1.2 then I'll rename the "flutter1.2" folder to "flutter"
In the environment variable path I have set the path to "flutter/bin" so if I rename flutter2.2 to flutter then my environment variable will automatically take 2.2 version.
You may need to restart your PC after changing the version.
The simple way is:
Download the version of Flutter you need and put it in the place where Flutter is installed
In this directory you have "flutter" folder.
In Ubuntu, it is usually located in this path:
/home/username/development/flutter
To develop the software with the desired version, just change the desired folder name to "flutter".
For example :
flutter --> flutter-2.x.x
flutter-3.x.x ---> flutter

Is there a way to check if a particular flutter plugin will work with a particular Android/IOS operating version?

I'd like to know if there is a way to determine if a flutter plugin will operate on a particular Android or IOS operating version?
For example would a flutter plugin like:
https://pub.dev/packages/http/
Work on android version 6 and older?
I expect that it would be dependent on the version of the plugin I'm intending to use.
Is there an easy way to check this?
You can view build.gralde file for check minimum Android version and plugin_name.podspec file (where plugin_name is name of the plugin) for minimum iOS requirements. Many plugins on pub.dev contains links to its source code (on GitHub or etc.)).
build.gradle contains in android folder, and you need to find line like this:
defaultConfig {
minSdkVersion 21
}
plugin_name.podspec file contains in ios folder, you need to find like this:
s.platform = :ios, '9.0'
Config files also contains more information about what version of Language plugin using.

Where is the version specified in Ionic app?

I'm using AppVersion.getVersionNumber() to get the version number of my Ionic app. But where does this number come from?
The problem is that when I run the app on a smartphone through devapp, I get a different version number depending on what OS I have…
iOS (on an iPhone 6): 1.0.2
Android (on a Samsung S10): 1.0.4
Searching around for "version" in my source code, I find this in config.xml (in the root):
<widget version="1.0.3" … >
I don't know if this is relevant, but it is the currently delivered version of the app.
I'm using Ionic 4.10.0
AppVersion cordova plugin reads the app details from the native code of the application.
So the version values that you see, are configured in the native IDE's.
Check these files in your respective platform folders..
ios/App/App.xcodeproj/project.pbxproj the key to look for in this MARKETING_VERSION
android/app/build.gradle the key to look for in this versionName

Is there a way to change version code in flutter

I'm setting up the app to upload on play store but the play console gives error-You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.
I tried changing the version code in android>app>build.gradle and even in local.properties but after hot reload or run command the local.properties automatically changes back to flutter.versionName=1.0.0 and flutter.versionCode=1.
It may be because of error in my build.gradle file as it shows red mark and give can't resolve symbol for properties,rootProperties,getProperty etc. and the same error with flutter.buildMode=release in local.properties
How can I solve this issue?
Instead of changing Gradle files, you need to make the changes in pubspec.yaml file.
It is located in the root directory of your project.
version: 1.0.0+1
A version number is three numbers separated by dots, like 1.2.43
followed by an optional build number separated by a +.
Google Play should accept your APK generated with increased build number.
This is briefly mentioned in the official documentation for releasing your app.
For Android and iOS, you need to update the "version" value in the pubspec.yaml file.
version: 1.0.0+1
For Android, the first piece ("1.0.0") corresponds to the version name whereas the piece after the + corresponds to version number.
For iOS, the first piece represents the CFBundleShortVersionString and the piece after the + represents the CFBundleVersion.
This answer has more information.