【问题标题】:error: package androidx.core.app does not exist when running flutter blue plugin错误:运行flutter blue插件时,包androidx.core.app不存在
【发布时间】:2020-02-24 10:43:28
【问题描述】:

我正在开发 Flutter 并使用 Flutter blue 插件。 一开始一切运行良好,但由于flutter blue插件版本,程序突然无法执行构建。

    dependencies:
      vector_math: any
      path_provider: ^1.3.0
      flutter:
        sdk: flutter
      flutter_map:
      flutter_blue: ^0.6.3+1
      cupertino_icons: ^0.1.2

这是错误信息

    C:\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_blue-0.6.3+1\android\
    src\main\java\com\pauldemarco\flutter_blue\FlutterBluePlugin.java:43:
    error: package androidx.core.app does not exist import androidx.core.app.ActivityCompat;
    ^
    error: package androidx.core.content does not exist
    import androidx.core.content.ContextCompat;

【问题讨论】:

    标签: android-studio flutter bluetooth dependencies androidx


    【解决方案1】:

    fullter_blue 版本0.6.3+1 存在这些类型的兼容性问题。我更喜欢您使用flutter_blue 0.6.2 版本,因为根据我自己的经验,它最稳定且工作正常。

    dependencies:
    ...
    flutter_blue: 0.6.2
    

    【讨论】:

    • 就像对其他人的说明:如果您想使用 0.6.2,请不要包含 ^,因此代码将为 flutter_blue: 0.6.2
    • @PouncingPoodle ^ 意味着什么?
    • @S.Ramjit 这意味着您将使用该库的最新版本。
    • 将其更改为 0.6.2 后,我收到了此警告 - flutterblue/FlutterBluePlugin.java 使用或覆盖了已弃用的 API。
    【解决方案2】:

    不幸的是,作者 (@pauldemarco) 似乎没有维护和发布 flutter_blue 插件。看这个问题

    似乎有几个人已经开始在 github 上使用 fork(由 @boskokg 维护)

    我自己(还)没有尝试过分叉。

    【讨论】:

      猜你喜欢
      • 2021-04-09
      • 2021-03-06
      • 1970-01-01
      • 2020-08-22
      • 2021-08-13
      • 2019-01-22
      • 1970-01-01
      • 2012-02-28
      • 1970-01-01
      相关资源
      最近更新 更多