Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to detect update using the flutter package "upgrader"

Tags:

flutter

I'm new to flutter and since I want the user to be automatically be notified if there is an update/force them to update, I used the flutter package upgrader(https://github.com/larryaasen/upgrader). The debug shows that there are no available updates even though my pubspec version is lower than the minimum app version that I set in the dart and XML.

dart:

final appcastURL = 'https://raw.githubusercontent.com/jeejaykim/apispa/jeejaykim-test/test.xml';
final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);

return Scaffold(
        body: UpgradeAlert(
            dialogStyle: UpgradeDialogStyle.cupertino,
            appcastConfig: cfg,
            debugLogging: true,
            showLater: false,
            showIgnore: false,
            minAppVersion: '120.0.0',
            child: Container(width: 0, height: 0)),
      );

Debug:

I/flutter ( 8444): upgrader: build UpgradeAlert
I/flutter ( 8444): FormatException: Cannot parse empty string into version
I/flutter ( 8444): upgrader: blocked: false
I/flutter ( 8444): upgrader: debugDisplayAlways: false
I/flutter ( 8444): upgrader: debugDisplayOnce: false
I/flutter ( 8444): upgrader: hasAlerted: false
I/flutter ( 8444): upgrader: appStoreVersion: null
I/flutter ( 8444): upgrader: installedVersion: null
I/flutter ( 8444): upgrader: minAppVersion: 120.0.0
I/flutter ( 8444): upgrader: isUpdateAvailable: false
I/flutter ( 8444): upgrader: shouldDisplayUpgrade: false
I/flutter ( 8444): upgrader: appcast item count: 4
I/flutter ( 8444): upgrader: appcast best item version: 200.0.0

pubspec:

version: 110.00.05+5
like image 598
user15352054 Avatar asked Oct 14 '25 16:10

user15352054


1 Answers

When I tested with your code and appcastURL, I can see the update popup.
I just added 'ios' to supportedOS parameter because I tested with iPhone simulator.

enter image description here

And here is a my full log when app is started.

flutter: upgrader: package info packageName: com.example.stackoverflow
flutter: upgrader: package info appName: null
flutter: upgrader: package info version: 110.00.05
flutter: upgrader: appcast is available for this platform
flutter: upgrader: appcast item count: 4
flutter: upgrader: appcast best item version: 200.0.0
flutter: upgrader: blocked: true
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: appStoreVersion: 200.0.0
flutter: upgrader: installedVersion: 110.00.05
flutter: upgrader: minAppVersion: 120.0.0
flutter: upgrader: isUpdateAvailable: true
flutter: upgrader: shouldDisplayUpgrade: true
flutter: upgrader: showDialog title: Update App?
flutter: upgrader: showDialog message: A new version of  is available! Version 200.0.0 is now available-you have 110.00.05.

It seems that 'package_info' package can not get 'versionName'. https://github.com/larryaasen/upgrader/blob/6f5827cd4feb3d13685ea4b2baa0911589876ab8/lib/src/upgrader.dart#L152

FormatException: Cannot parse empty string into version

Would you check flutterVersionName in 'android/app/build.gradle' file? My code is below.


def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

If it is same with my code, please do below steps.

flutter clean
flutter pub get
flutter run

And there is a 'local.properties' file generated in '/android'.
Please check 'flutter.versionName' value in that file.

like image 180
KuKu Avatar answered Oct 17 '25 07:10

KuKu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!