im new to flutter , can you help please - android

I want to upload a new version of the application
this is my pubspec.yaml
version: 1.0.0+1
i dont now how to make it
should i change it to ???
version: 1.0.1+1

The version in flutter apps tries to follow the software versioning system, this means:
major.minor.patch+build
So if you are on major = 2, minor = 0, patch=13 and build = 4, it would be: 2.0.13+4
Now, the semantics for this are:
MAJOR version when you make incompatible API changes.
MINOR version when you add functionality in a backwards compatible manner.
PATCH version when you make backwards compatible bug fixes.
https://semver.org/
And build is for different compilations for a single code base, that could be that you are ready to upload your application and found out about a bug, then you do the cahnge and only increase the build number.

Related

Flutter: Is the build number/version code optional or mandatory?

I added my app bundle to the Google Console for internal testing and the version was
version: 1.0.0+1
Now I want to add some fixes and so upgraded the app version and removed the build number
version: 1.0.1
But Google Play gives the below error
Version code 1 has already been used. Try another version code.
But if the the build number is optional as mentioned by the
documentation then why is it giving an error?
Will I always have to add build number and increment no matter the
major and minor versions?
https://docs.flutter.dev/deployment/android#updating-the-apps-version-number**
The version number is three numbers separated by dots, such as 1.0.0
in the example above, followed by an optional build number such as 1
in the example above, separated by a +.
in a Flutter project, what define the name of the version is the 1.0.1, but what define the count of the update is +1, so by setting version like this:
version: 1.0.1+1
you say 'the name of this version is 1.0.1, it's my first ( +1 ) update', so the next time when you set it like this:
version: 1.0.2+1
you say 'the name of this version is 1.0.2, it's my first ( +1 ) update'.
and here the Google play console throws that error to you to change it, it uses that +1 to know how it should list your app version in the console, so you need a different one every time you update your app, you need to do like this as an example:
version: 1.0.2+2
after the build, when you upload it, it will work fine.
But Note: if you uploaded for the next time with a different version, and they rejected it again for example the :
You must complete the advertising ID declaration before you can release an app that targets Android 13 (API 33). We'll use this declaration to provide safeguards in Play Console to accommodate changes to advertising ID in Android 13.
even if it's rejected, it remember new upload with that version code, so after fixing the issue, you need to either change again the version code and re-upload again, or you can in your console to delete the rejected previous uploaded app to it's version code.

Flutter "Add 2 App" Android integration with adjustments to generated .android

I'm working on an Android app with 3+ years of Kotlin development and want to gradually migrate it to Flutter feature-by-feature. I use option B of the "add 2 app" integration where I depend on the module's source code. Features written Flutter are integrated into the native Android app with FlutterActivity or FlutterFragment. This worked great for the first feature however now I have an issue with migrating the second feature. The second feature requires the packages camera and firebase_ml_vision. Now the problem is that camera requires a min SDK of 21 but the generated Android code in .android sets the min SDK to 16. Additionally firebase_ml_vision requires initialization of Firebase which also needs to be added to .android. I'm thinking about adding .android to VCS and add the required changes however this is generated code. It gets removed when flutter clean is called and generated on flutter pub get. I would have to constantly adjust the generated code when Flutter changes/removes it :( .android only hosts the "skeleton" Android app which is started when the Flutter project is run from IDE (or command line). It is not the host app (the old, native app) where Firebase is already configured. However the .android app is used for quick development cycles. If I cannot use this anymore because of said limitations, I would always have to start the native Android app (host) and lose many benefits of Flutter like hot reload :( Has anyone come across the same problem?
Update:
In this article they clearly state that .android should not be modified or added to VCS. They even mention the camera module as an example. However this does not work and can be reproduced with a few simple steps:
Create a new module: flutter create --template=module --project-name example
cd example
Add camera plugin to pubspec.yaml
flutter pub get
Now running flutter build apk results in the following error:
/Users/sven/Development/example/.android/app/src/main/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:camera] /Users/sven/.pub-cache/hosted/pub.dartlang.org/camera-0.5.8+11/android/build/intermediates/library_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="io.flutter.plugins.camera" to force usage (may lead to runtime failures)
I noticed you are facing 2 issues/ questions:
Minimum android sdk compatibility mismatch: Probably requires some work by the flutter team for a proper fix (I expected the flutter_module/build.gradle to be more useful, but it wasn't (not the one in build/ or .android), but as a workaround, some :app module AndroidManifest.xml changes using uses-sdk will work:
<manifest ...>
<uses-sdk android:targetSdkVersion="29" android:minSdkVersion="21"
tools:overrideLibrary="com.example.flutter_module, com.example.flutter_module.host"/>
...
</manifest>
(I set the default package name for the flutter module but you should replace both instances of com.example.flutter_module with your package name. (check your build.gradles). What I do here is raise the minSDK for the 2 flutter modules that were added. The error message you got recommended lowering the minSDK for camera to 16, but this is not a good idea (the camera plugin developers set it to 21 probably because the APIs they use have minSDK 21, e.g. camera2).
How to setup firebase/ dependencies config in build.gradle? (i.e. firebase_ml_vision and firebase 'platform specific configuration'): Change your main app's app/build.gradle and AndroidManifest.xml as per the instructions. This is what the doc says:
Perform those Android Gradle file edits on your outer, existing Android app rather than in your Flutter module.
Let me know if you need anymore help :)
on android/app/build.gradle changing minSdkVersion to 21

What version code comes after e.g v 1.0.9 for an android app

Im a beginner in flutter development and i'm not very familiar with versioning of an app. i believe from version 1.0.9 it's supposed to be 1.0.10 but everytime i try to upload my new release i get an error that i already have a release with version code 1. Whats could be the issue?
v 1.1.0 comes after 1.0.9. Also make sure to change the version code.
if the current version is 1.0.9+10 , then you need to change it to 1.1.0+11
where +10 and +11 is the version code.
Make these changes in the pubspec.yaml file. For example:
version: 1.1.0+11
Make sure the Version code of the app is updated before publishing the app

Update App React Native 32 Bits to 64 Bits

I have an outdated 32-bit application to react native, now I want to update that application with the latest versions, my question is, I have to work on that application or I can create a new one with the same package name and the same keystore, in such a way that it helps me to update the previous one, I hope you have explained, thanks in advance.
I recently had to upgrade a react native app from 0.49 to the latest, 0.61. There's some tools available, react-native upgrade and react-native-git-upgrade, but I had little luck with either one.
For me the easiest way was performing the update on the current codebase, with the help of RN diff purge: react-native-community/rn-diff-purge
From their README.md :
This repository exposes an untouched React Native app generated with the CLI npx >react-native init RnDiffApp. Each new React Native release causes a new project to >be created, removing the old one, and getting a diff between them. This way, the >diff is always clean, always in sync with the changes of the init template.
For whichever version you're currently at, you can look up the diff of a clean project in that version to whichever other version you'd like to upgrade to. You can check all the changes that happened between those two versions, and apply them to you own project. When I upgraded, I just applied the changes in rn-diff-purge/compare/release0.49.1..release/0.61.5 to my project.
Some things to conider:
If you only need to upgrade react native to be able to get 64 bit builds, it's going to be way less work to update to 0.59 (first version to support 64bit), than to upgrade to 0.60 or later. On version 0.60 they introduced auto-linking, meaning that you no longer need to run react-native link after installing a native dependency, but you'll need to unlink all of your current native dependencies if you don't want to see some "duplicate dependency" errors.
If you do decide to upgrade to 0.60 or later, and you have some dependency that you don't want to unlink (maybe you've added react-native-code-push, and you set the deploymentKey when you initialize the package in your MainApplication.java), you need to add them to the file react-native.config.js (if you don't have one, you should create one at the root of your project). The file should look like this:
module.exports = {
dependencies: {
'react-native-code-push': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
},
},
};
That's all, good luck!

Google Play Store Release Issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed last year.
The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved
Improve this question
I am trying to release a new version of my Android App.
I can upload the APK file but after I click the "Review" Button I am getting below error.
Review summary
Errors
Resolve these errors before starting the rollout of this release.
You can't rollout this release because it doesn't allow any existing users to upgrade to the newly added APKs.
Please note that this app was developed using CORDOVA
The app version details are as below image. The only difference from the previous and this new version is the Target SDK is changed from 24 to 26
Can someone please give some idea to fix this issue. Thanks for your help
I contacted the Google support and they replied within 24 hours.
The issue is the android:versionCode in the AndroidManifest.xml is lower than my previous release. After I fixed the issue I was able to release my app without any issue.
How I fixed the issue
I changed the android-versionCode to a higher value in <manifest tag in the config.xml file so AndroidManifest.xml has the higher value.
Full reply from Google
Hi,
Thanks for contacting Google Play Developer Support.
You're seeing that error message because your new APK has a lower version code than the previous APK. Newer APKs must always have a higher version code than the previous version, or the Play Store won't know that the new APK is an update. Please change your new APK's version code to be at least 206020.
Regards,
Google Play Developer Support
If your Old APK version is a higher number than your New APK version then you get this error.
It is not the version name that matters, that can actually be any string, it is only the version code which must always be higher than a previous version.
https://developer.android.com/studio/publish/versioning
To fix for Flutter
In pubspec.yaml it is the version line, and the number after the + sign is the one that must be higher than the Old Version Code shown in the Google Play Console screen as the "1 app bundle deactivated".
That would be 50 if this was your version line :
version: 1.0.0+50
I faced same issue, interestingly the versioncode(120001) of new release (12.0.0) was less than the versioncode(1104058) previous release (11.4.5)
I resolved this issue following this link Setting Android version code in Ionic 2
Update both versionCode and versionName.
minSdkVesion 16
targetSdkVesion 26
versionCode 2
versionName 1.1
In your config.xml file's <widget> element, add/increment the android-versionCode attribute by one:
<widget id="com.example.foo" version="1.0.1" android-versionCode="10001" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
After that, running a cordova clean android and cordova build android --release gave me an .apk that the Google Play Console accepted.
have you upgraded your versionCode from previous versionCode?
minSdkVesion 16
targetSdkVesion 26
versionCode 1 //you need to upgrade it from previous one
versionName 1.0
If you are Monaca Cloud IDE for building and you are facing this error You cannot make this version available because it does not allow existing users to upgrade to new APKs that have been added.
So here what is the problem, When you try to build APK then it generates a random number,
So make sure your new update version code is greater then this 10505
You can set in Monaca Cloud IDE version code
In the root of your project will be a config.xml file. It contains a widget node that has an attribute of version. 1.17.01 in Example: <widget id="com.myapp.mobile" version="1.17.01" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
During a cordova prepare operation, this config.xml file is merged into the manifest file for your platform (e.g. platforms\android\app\src\main\AndroidManifest.xml for Android). The merged manifest file will contain both a version code and version string generated from the version listed in the config.xml. Ex: <manifest android:hardwareAccelerated="true" android:versionCode="11701" android:versionName="1.17.01" package="com.myapp.mobile" xmlns:android="http://schemas.android.com/apk/res/android">
This version code 11701 will be what is listed on the play console.
To automatically set this version greater, you can add to your gradle.properties file a variable setting cdvVersionCodeForceAbiDigit=true which will automatically multiply the version by 10. Note this logic is laid out in the build.gradle file at the root of your platform app folder. There is other logic toggled with the cdvBuildMultipleApks variable to set different values based on product flavor (arm, x86, etc). But I think the recommended approach today is to upload a "bundle" and let Google automatically generate the separate apks for various device configurations.

Categories

Resources