best-flutter/flutter_amap_location

AMapLocationClient.startup 时报错

jojo921 opened this issue · 1 comments

platform : android-arm64 • Android 9 (API 28)

code

 PermissionStatus status  =  await Permission.locationWhenInUse.request();
    if (status != PermissionStatus.granted) {
      debugPrint("获取定位权限失败");
      return;
    }
      await AMapLocationClient.startup(new AMapLocationOption(
        desiredAccuracy: CLLocationAccuracy.kCLLocationAccuracyHundredMeters));
    var location = await AMapLocationClient.getLocation(true);
    debugPrint("$location");

#result:

Rejecting re-init on previously-failed class java.lang.Class<com.loc.ea$a>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/telephony/TelephonyManager$CellInfoCallback;

这个貌似是因为TelephonyManager.CellInfoCallback是Android 10(Api 29) 才添加的api,跑在Android 9上他就会找不到这个类……
作为安卓开发新手,我也遇到了这个问题,貌似无解