Search code examples
android-studioflutterbluetoothdependenciesandroidx

error: package androidx.core.app does not exist when running flutter blue plugin


I'm working on Flutter and use Flutter blue plugin. Everything ran well at the beginning but suddenly the program can't perform build because of flutter blue plugin version.

    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

this is the error message

    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;

Solution

  • The fullter_blue version 0.6.3+1 has these types of compatibility issues. I prefer you to use the flutter_blue 0.6.2 version as it is most stable and working correctly as per my own experience.

    dependencies:
    ...
    flutter_blue: 0.6.2