1、Android 使用问题
/Users/***/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.6.3+1/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java:43: 错误: 程序包androidx.core.app不存在
import androidx.core.app.ActivityCompat;
^
/Users/***/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.6.3+1/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java:44: 错误: 程序包androidx.core.content不存在
import androidx.core.content.ContextCompat;
^
/Users/***/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.6.3+1/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java:150: 错误: 找不到符号
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_COARSE_LOCATION)
^
符号: 变量 ContextCompat
位置: 类 FlutterBluePlugin
/Users/***/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.6.3+1/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java:152: 错误: 找不到符号
ActivityCompat.requestPermissions(
^
符号: 变量 ActivityCompat
位置: 类 FlutterBluePlugin
注: /Users/***/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_blue-0.6.3+1/android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: //Users/***/***/build/flutter_blue/generated/source/proto/debug/javalite/com/pauldemarco/flutter_blue/Protos.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
4 个错误"
- 解决办法
在flutter_blue插件中,'android/build.gradle'路径
添加如下:
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core:1.1.0'
}
2、iOS 使用问题
While building module 'flutter_blue' imported from
/Users/***/***/ios/Runner/GeneratedPluginRegistrant.m:10:
In file included from <module-includes>:1:
/Users/***/***/build/ios/Debug-iphoneos/flutter_blue/flutter_blue.framework/Headers/fl
utter_blue-umbrella.h:13:9: fatal error: 'FlutterBluePlugin.h' file not found
#import "FlutterBluePlugin.h"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/***/***/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: could not
build module 'flutter_blue'
@import flutter_blue;
~~~~~~~^~~~~~~~~~~~
2 errors generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
From your project's root folder:
Clean everything:
rm -rf ios/Pods
rm ios/Podfile
rm ios/Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData/
flutter clean
flutter packages upgrade
Regenerate the Podfile with:
flutter run
Open ios/Podfile and comment the following line:
use_frameworks!
platform :ios, '9.0'
网友评论