user15352054
user15352054

Reputation: 41

Unable to detect update using the flutter package "upgrader"

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

Upvotes: 4

Views: 7389

Answers (4)

Nayan Gadhiya
Nayan Gadhiya

Reputation: 1

[enter image description here][1]enter image description hereIf your app is not hosted on Play Store or App Store, you can still implement version checking using the upgrader package by hosting an appcast file on your own server. The appcast file contains version details, and the app can check for updates based on that. Below is an example of how to set this up in Flutter using an appcast URL.

and here test Appcast hosted xml URL "https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml" (Replace Your Own URL)

Upvotes: 0

Nishant Jaiswal
Nishant Jaiswal

Reputation: 39

So my current version is 1.0.7+15 for debugging I changed it to 1.0.6+15 it detected, but not when I changed it to 1.0.7+14 so if you change only the version name or version name and version code, it detects, but when you change only the version code, it doesn't detect.

The version name is 1.0.7 The version code is 15

Upvotes: 0

Charles Arko-Clayman
Charles Arko-Clayman

Reputation: 336

The appCastUrl ('https://raw.githubusercontent.com/jeejaykim/apispa/jeejaykim-test/test.xml') points to a page thats 404 (not found).

enter image description here

Try this instead: https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml

Alternatively, you can create your own raw github user content using Appcast Sample File on the package docs page (on pub.dev). Using the format:

raw.githubusercontent.com/username/repo-name/branch-name/path

Upvotes: 0

KuKu
KuKu

Reputation: 7492

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.

Upvotes: 2

Related Questions