Flutter AppUpdateService linkToDeath

Rat*_*rty 11 android ios dart flutter in-app-update

I have been trying to add the in app update feature to make the user update the app when there is a new update available in the playstore. I am using the package in_app_update.

But it keeps throwing this error,

I/PlayCore( 8420): UID: [10378]  PID: [8420] AppUpdateService : requestUpdateInfo(com.example.app)
I/PlayCore( 8420): UID: [10378]  PID: [8420] AppUpdateService : Initiate binding to the service.
I/PlayCore( 8420): UID: [10378]  PID: [8420] AppUpdateService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.installservice.DevTriggeredUpdateService})
I/PlayCore( 8420): UID: [10378]  PID: [8420] AppUpdateService : linkToDeath
I/PlayCore( 8420): UID: [10378]  PID: [8420] OnRequestInstallCallback : onRequestInfo
I/PlayCore( 8420): UID: [10378]  PID: [8420] AppUpdateService : Unbind from service.
W/JavaBinder( 8420): BinderProxy is being destroyed but the application did not call unlinkToDeath to unlink all of its death recipients beforehand.  Releasing leaked death recipient: com.google.android.play.core.internal.ac
Run Code Online (Sandbox Code Playgroud)

The code I am using is,

try {
  if (Platform.isAndroid) {
    InAppUpdate.checkForUpdate().then((info) {
      setState(() {
        _updateInfo = info;
      });
    }).catchError((error) => print(error));

    if (_updateInfo?.updateAvailable == true) {
      InAppUpdate.performImmediateUpdate()
          .catchError((error) => print(error));
    }
  }
} catch(e) {
    print(e);
}
Run Code Online (Sandbox Code Playgroud)

在使用上述包失败几天后,我尝试使用另一个名为native_updater 的包。这个包也导致了同样的错误。尽管我遵循了他们的榜样,但这应该有效。

的输出flutter doctor是,

Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel master, 1.22.0-10.0.pre.121, on Linux, locale en_US.UTF-8)
 
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[?] Android Studio (version 4.0)
[?] Connected device (1 available)


Run Code Online (Sandbox Code Playgroud)

我找不到任何类似的问题或答案,这就是为什么必须发布一个。

我使用的是 64 位 Kali Linux 机器。

Hof*_*emy 5

一开始我和你有同样的问题。但我注意到一些事情,必须从 Play 商店下载该应用程序,并且还必须提供更新。如果您通过从 flutter 或 vscode 启动应用程序来执行此操作,则它不起作用是正常的。不知道我有没有说清楚。

请注意,此插件无法在本地进行测试。它必须通过 Google Play 安装才能工作。请查看有关 Google 应用内更新的官方文档。