best-flutter / flutter_amap_location Goto Github PK
View Code? Open in Web Editor NEW高德地图flutter定位组件
License: MIT License
高德地图flutter定位组件
License: MIT License
ios 怎么需要那么多权限!!!
NSCalendarsUsageDescription
NSContactsUsageDescription
NSAppleMusicUsageDescription
NSMotionUsageDescription
NSSpeechRecognitionUsageDescription
钓鱼???
For a more detailed help message, press "h". To quit, press "q".
D/AmapLocationPugin( 7359): 定位获取结果:37.422075 code:0 省:California
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.d.b(AmapLocationManager.java)
W/System.err( 7359): at com.loc.d.f(AmapLocationManager.java)
W/System.err( 7359): at com.loc.d$a.handleMessage(AmapLocationManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.d$b.run(AmapLocationManager.java)
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.d.b(AmapLocationManager.java)
W/System.err( 7359): at com.loc.d.f(AmapLocationManager.java)
W/System.err( 7359): at com.loc.d$a.handleMessage(AmapLocationManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.d$b.run(AmapLocationManager.java)
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
I/authErrLog( 7359):
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.bk.b(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.e.a(ApsManager.java)
W/System.err( 7359): at com.loc.e$a.handleMessage(ApsManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.e$b.run(ApsManager.java)
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.bk.b(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.e.a(ApsManager.java)
W/System.err( 7359): at com.loc.e$a.handleMessage(ApsManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.e$b.run(ApsManager.java)
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.cm.d(Aps.java)
W/System.err( 7359): at com.loc.e.b(ApsManager.java)
W/System.err( 7359): at com.loc.e$a.handleMessage(ApsManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.e$b.run(ApsManager.java)
W/System.err( 7359): com.loc.k: IO 操作异常 - IOException
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bn.a(HttpUrlUtil.java)
W/System.err( 7359): at com.loc.bk.a(BaseNetManager.java)
W/System.err( 7359): at com.loc.db.a(LocNetManager.java)
W/System.err( 7359): at com.loc.cm.a(Aps.java)
W/System.err( 7359): at com.loc.cm.d(Aps.java)
W/System.err( 7359): at com.loc.e.b(ApsManager.java)
W/System.err( 7359): at com.loc.e$a.handleMessage(ApsManager.java)
W/System.err( 7359): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 7359): at android.os.Looper.loop(Looper.java:148)
W/System.err( 7359): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 7359): at com.loc.e$b.run(ApsManager.java)
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
D/AmapLocationPugin( 7359): 定位获取结果:22.011949782470765 code:0 省:
业务需求是,每十秒获取一个定位信息,发给后端存起来,在ios系统下,退出程序到后台,每十秒的定时器正常工作,但此时定位值获取到的都是null。
测试手机iphone 5s .运行的是Flutter工程。
点击地图时,崩溃了。
错误提示大概是:getSearchPOIData FAIL: mFunc == NULL。
xcode工程上错误定位在,AMapViewFactory.m的第170行,171行。
代码为:
AMapLocationClient.startup(new AMapLocationOption(desiredAccuracy:CLLocationAccuracy.kCLLocationAccuracyHundredMeters, locatingWithReGeocode: true), );
AMapLocation loc = await AMapLocationClient.getLocation(true);
iOS没有城市信息, 只有经纬度
`
void initState() {
super.initState();
setState(() {
this.isLoading = true;
});
AMapLocationClient.startup(new AMapLocationOption(
desiredAccuracy: CLLocationAccuracy.kCLLocationAccuracyHundredMeters));
getCurrentLocation();
}
Future requestPermission() async {
final permissions = await PermissionHandler()
.requestPermissions([PermissionGroup.location]);
if (permissions[PermissionGroup.location] == PermissionStatus.granted) {
return true;
} else {
CLToast.showToast('需要定位权限');
return false;
}
}
Future getCurrentLocation() async {
if (await requestPermission()) {
AMapLocation loc = await AMapLocationClient.getLocation(true);
log('123123123' + loc.latitude.toString() + loc.longitude.toString());
setState(() {
this._location = loc;
});
}
}`
D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省:
D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省:
报下面的错误:
2018-08-14 21:27:02.088953+0800 Runner[368:38661] [BoringSSL] Function boringssl_session_errorlog: line 2881 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert
*** First throw call stack:
(
0 CoreFoundation 0x000000010d3831e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010be72031 objc_exception_throw + 48
2 CoreFoundation 0x000000010d3c30bc _CFThrowFormattedException + 194
3 CoreFoundation 0x000000010d296951 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321
4 CoreFoundation 0x000000010d2967db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
5 Runner 0x0000000108efa421 +[AmapLocationPlugin regeocode2map:] + 849
6 Runner 0x0000000108efac6b -[AmapLocationPlugin amapLocationManager:didUpdateLocation:reGeocode:] + 251
7 Runner <…>
错误日志:
2020-02-01 17:28:44.678 23129-23238/? E/AndroidRuntime: FATAL EXCEPTION: pama#1
Process: com.xxxx.abc, PID: 23129
java.lang.AbstractMethodError: abstract method "void android.telephony.TelephonyManager$CellInfoCallback.onCellInfo(java.util.List)"
at android.telephony.TelephonyManager$1.lambda$onCellInfo$0(TelephonyManager.java:5319)
at android.telephony.-$$Lambda$TelephonyManager$1$scMPky6lOZrCjFC3d4STbtLfpHE.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
这里有文章详细说明
https://blog.csdn.net/daijin888888/article/details/103920227
@override
void initState() {
super.initState();
_type = widget.type;
WidgetsBinding.instance.addPostFrameCallback((call) async {
/// !注意: 只要是返回Future的方法, 一律使用`await`修饰, 确保当前方法执行完成后再执行下一行,
/// 在不能使用`await`修饰的环境下, 在`then`方法中执行下一步.
/// 初始化 iOS在init方法中设置, android需要去AndroidManifest.xml里去设置, 详见 https://lbs.amap.com/api/android-sdk/gettingstarted
if (Platform.isIOS) {
LogUtil.e('', tag: 'IOS初始化高德地图API:');
await AMapLocationClient.setApiKey('这是appKey').then((boo){
LogUtil.e('$boo', tag: 'IOS初始化高德地图API返回值:');
});
}
// 单次定位
if (await _requestPermission()) {
//先启动一下
bool boo = await AMapLocationClient.startup(new AMapLocationOption(
desiredAccuracy: CLLocationAccuracy.kCLLocationAccuracyHundredMeters));
LogUtil.e('$boo', tag: '启动高德地图API返回值:');
// 直接获取定位:
// await AMapLocationClient.getLocation(true);
// 监听定位
AMapLocationClient.onLocationUpate.listen((AMapLocation loc) {
LogUtil.e('$mounted', tag: 'IOS初始化高德地图API - mounted:');
LogUtil.e('$loc', tag: 'IOS初始化高德地图API - loc:');
if (!mounted) return;
setState(() {
_location = loc;
});
});
AMapLocationClient.startLocation();
} else {
Utils.showToast('定位失败!');
}
});
}
iOS环境下完全没有执行到监听,android环境没有问题。是不是我哪里少了配置。
采用直接获取定位也是获取不到位置信息的
AMapLocationClient.getLocation(true).then((AMapLocation loc) {
LogUtil.e('$mounted', tag: '高德地图API - mounted:');
LogUtil.e('$loc', tag: '高德地图API - loc:');
if (!mounted) return;
setState(() {
_location = loc;
});
});
安卓控制台打印:定位获取结果:0.0 code:12 省:
iOS 没有任何响应
代码如下:
PermissionStatus permission1 = await LocationPermissions().requestPermissions(); //请求许可
if(permission1 != PermissionStatus.granted){
await LocationPermissions().openAppSettings();
return;
}
await AMapLocationClient.startup(new AMapLocationOption(desiredAccuracy:CLLocationAccuracy.kCLLocationAccuracyHundredMeters ));
AMapLocation location = await AMapLocationClient.getLocation(true);
if(location.success){
print('获取位置信息结果:'+location.city != null?location.city:'暂无');
}
使用 amap_location: ^0.2.0
Flutter 1.5.4-hotfix.2 • channel stable
Dart 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
会报下面这个找不到类的错误,请解决一下
/Users/hongka-liming/hongka4.0/flutterHK/hongka_flutter/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:30: 错误: 无法访问AMapLocationListener
AmapLocationPlugin.registerWith(registry.registrarFor("com.jzoom.amaplocation.AmapLocationPlugin"));
^
找不到com.amap.api.location.AMapLocationListener的类文件
1 个错误
Finished with error: Gradle task assembleDebug failed with exit code 1
嗨,AmapLocationPlugin.java 文件中,第148行应该是获取城市,源代码中写成了获取国家map.put("city",a.getCountry()); 应改成 map.put("city",a.getCity());
[AMapLocationKit] 要在iOS 11及以上版本使用后台定位服务, 需要实现amapLocationManager:doRequireLocationAuth: 代理方法
如何解决?
XCode运行的时候编译报错'amap_location/AmapLocationPlugin.h' file not found.
请问这个怎么解决?
已经解决
https://blog.csdn.net/qq_32319999/article/details/80347976
直接RUN可以运行,制作ipa包报错
移动定位后,如何根据坐标 获取详细地址信息?
大佬,闪退,权限我加了,key我也添加了,出现这个原因,是什么导致的
_formattedAddress __NSCFString * @"山西省晋城市沁水县靠近前土门上"
_country __NSCFString * @"**"
_province __NSCFString * @"山西省"
_city __NSCFString * @"晋城市"
_district __NSCFString * @"沁水县"
_township id 0x0
_neighborhood id 0x0
_building id 0x0
_citycode NSTaggedPointerString * @"0356"
_adcode NSTaggedPointerString * @"140521"
_street id 0x0
_number id 0x0
_POIName __NSCFString * @"前土门上"
_AOIName id 0x0
Could not determine the dependencies of task ':amap_location:compileDebugAidl'.
Could not resolve all task dependencies for configuration ':amap_location:debugCompileClasspath'.
Could not resolve com.amap.api:location:latest.integration.
Required by:
project :amap_location
> Failed to list versions for com.amap.api:location.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 36s
after compile on iOS will raising a error simple_permissions/simple_permissions-Swift.h' file not found
pls check it.
btw, it's working on android perfectly~
AMapLocationClient 不支持多个实例 这样如果需要使用到连续定位和单次定位时 会有冲突
逆地理错误:{3 - 逆地理错误(INVALID_USER_SCODE)};
[C3.1.1 CF403C1C-9BD3-4EBF-A445-FA1C5ED9D24D 192.168.18.118:53101<->106.11.19.109:443]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 0.202s, DNS @0.003s took 0.001s, TCP @0.004s took 0.047s, TLS took 0.105s
bytes in/out: 3679/1687, packets in/out: 5/4, rtt: 0.043s, retransmitted packets: 0, out-of-order packets: 2
iOS模拟器,系统13.3
Could not resolve all task dependencies for configuration ':amap_location:releaseRuntimeClasspath'.
Could not resolve com.amap.api:location:latest.integration.
Required by:
project :amap_location
> Failed to list versions for com.amap.api:location.
> Unable to load Maven meta-data from http://repo1.maven.org/maven2/com/amap/api/location/maven-metadata.xml.
> Could not HEAD 'http://repo1.maven.org/maven2/com/amap/api/location/maven-metadata.xml'. Received status code 501 from server: HTTPS Required
flutter sdk:1.2.1
开发机系统:macos10.14.4
ios: 12.1.4
xcode日志如下:
2019-04-22 19:24:09.579660+0800 Runner[1122:349461] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2019-04-22 19:24:09.579704+0800 Runner[1122:349461] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2019-04-22 19:24:10.037104+0800 Runner[1122:349540] flutter: Observatory listening on http://127.0.0.1:61903/
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 1122, TID: 349559, Thread name: com.autonavi.AMapLocationThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x00000001ab19b534 <redacted> + 56
5 CoreLocation 0x00000001b2fa24a0 CLClientStopVehicleHeadingUpdates + 142072
6 CoreLocation 0x00000001b2f795d0 CoreLocation + 5584
7 CoreLocation 0x00000001b2f79cc0 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 128
8 CoreLocation 0x00000001b2f79bc8 CLClientCreateWithBundleIdentifierAndPath + 320
9 CoreLocation 0x00000001b2f85344 CLClientStopVehicleHeadingUpdates + 22940
10 CoreLocation 0x00000001b2f85b48 CLClientStopVehicleHeadingUpdates + 24992
11 Runner 0x00000001006d7e14 -[AMapLocationManager initCLManager] + 56
12 Runner 0x00000001006d7da0 -[AMapLocationManager createLocationManager] + 28
13 libobjc.A.dylib 0x00000001ab19b2a4 <redacted> + 68
14 Foundation 0x00000001aca6de38 <redacted> + 340
15 CoreFoundation 0x00000001abf3451c <redacted> + 28
16 CoreFoundation 0x00000001abf34498 <redacted> + 92
17 CoreFoundation 0x00000001abf33d50 <redacted> + 180
18 CoreFoundation 0x00000001abf2ea08 <redacted> + 1032
19 CoreFoundation 0x00000001abf2e2e8 CFRunLoopRunSpecific + 452
20 Foundation 0x00000001ac9323e0 <redacted> + 304
21 Foundation 0x00000001ac96f1cc <redacted> + 92
22 Runner 0x00000001006ccac0 +[AMapLocationCLMDelegate threadEntryPoint:] + 216
23 Foundation 0x00000001ac930fc0 <redacted> + 72
24 Foundation 0x00000001aca6dc44 <redacted> + 1044
25 libsystem_pthread.dylib 0x00000001abba8974 <redacted> + 132
26 libsystem_pthread.dylib 0x00000001abba88d0 _pthread_start + 52
27 libsystem_pthread.dylib 0x00000001abbb0ddc thread_start + 4
2019-04-22 19:24:10.504164+0800 Runner[1122:349559] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 1122, TID: 349559, Thread name: com.autonavi.AMapLocationThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x00000001ab19b534 <redacted> + 56
5 CoreLocation 0x00000001b2fa24a0 CLClientStopVehicleHeadingUpdates + 142072
6 CoreLocation 0x00000001b2f795d0 CoreLocation + 5584
7 CoreLocation 0x00000001b2f79cc0 CLClientCreateWithBundleIdentifierAndPathOnRunLoop + 128
8 CoreLocation 0x00000001b2f79bc8 CLClientCreateWithBundleIdentifierAndPath + 320
9 CoreLocation 0x00000001b2f85344 CLClientStopVehicleHeadingUpdates + 22940
10 CoreLocation 0x00000001b2f85b48 CLClientStopVehicleHeadingUpdates + 24992
11 Runner 0x00000001006d7e14 -[AMapLocationManager initCLManager] + 56
12 Runner 0x00000001006d7da0 -[AMapLocationManager createLocationManager] + 28
13 libobjc.A.dylib 0x00000001ab19b2a4 <redacted> + 68
14 Foundation 0x00000001aca6de38 <redacted> + 340
15 CoreFoundation 0x00000001abf3451c <redacted> + 28
16 CoreFoundation 0x00000001abf34498 <redacted> + 92
17 CoreFoundation 0x00000001abf33d50 <redacted> + 180
18 CoreFoundation 0x00000001abf2ea08 <redacted> + 1032
19 CoreFoundation 0x00000001abf2e2e8 CFRunLoopRunSpecific + 452
20 Foundation 0x00000001ac9323e0 <redacted> + 304
21 Foundation 0x00000001ac96f1cc <redacted> + 92
22 Runner 0x00000001006ccac0 +[AMapLocationCLMDelegate threadEntryPoint:] + 216
23 Foundation 0x00000001ac930fc0 <redacted> + 72
24 Foundation 0x00000001aca6dc44 <redacted> + 1044
25 libsystem_pthread.dylib 0x00000001abba8974 <redacted> + 132
26 libsystem_pthread.dylib 0x00000001abba88d0 _pthread_start + 52
27 libsystem_pthread.dylib 0x00000001abbb0ddc thread_start + 4
2019-04-22 19:24:19.270201+0800 Runner[1122:349461] {
allowsBackgroundLocationUpdates = 0;
desiredAccuracy = kCLLocationAccuracyHundredMeters;
detectRiskOfFakeLocation = 0;
distanceFilter = "-1";
geoLanguage = DEFAULT;
locatingWithReGeocode = 0;
locationTimeout = 5;
pausesLocationUpdatesAutomatically = 0;
reGeocodeTimeout = 5;
}
2019-04-22 19:24:19.376661+0800 Runner[1122:349527] [NetworkInfo] Could not successfully update network info for descriptor <CTServiceDescriptor 0x281ce87c0, domain=1, instance=2> during initialization.
2019-04-22 19:24:19.378029+0800 Runner[1122:349527] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281ce8720, domain=1, instance=1>
2019-04-22 19:24:19.378411+0800 Runner[1122:349527] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x281ce87c0, domain=1, instance=2>
after get location permission, get error of auth, does my andriod key is
illegal?
amap_location: 0.1.2
Android studio 3.5.1
classpath 'com.android.tools.build:gradle:3.4.2'
Launching lib/main.dart on ELE AL00 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':amap_location:generateDebugRFile'.
> Could not resolve all task dependencies for configuration ':amap_location:debugRuntimeClasspath'.
> Could not resolve com.amap.api:location:latest.integration.
Required by:
project :amap_location
> Failed to list versions for com.amap.api:location.
> Unable to load Maven meta-data from http://maven.aliyun.com/nexus/content/repositories/releases/com/amap/api/location/maven-metadata.xml.
> Could not get resource 'http://maven.aliyun.com/nexus/content/repositories/releases/com/amap/api/location/maven-metadata.xml'.
> Could not GET 'http://maven.aliyun.com/nexus/content/repositories/releases/com/amap/api/location/maven-metadata.xml'.
> Read timed out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 33s
Finished with error: Gradle task assembleDebug failed with exit code 1
集成了插件,调试模式没有问题。build发布release版本之后启动就会闪退
flutter_amap_location/android/build.gradle
Lines 39 to 41 in fcfcf3d
这里是不是应该放android块 里面啊
或者 compile 的问题
虽然现在可以在android端加入这个依赖
0 | CoreFoundation | __exceptionPreprocess
4 | CoreFoundation | +[NSDictionary dictionaryWithObjects:forKeys:count:]
5 | Runner | AmapLocationPlugin.m line 200+[AmapLocationPlugin regeocode2map:]
6 | Runner | AmapLocationPlugin.m line 175__41-[AmapLocationPlugin getLocation:result:]_block_invoke
7 | libdispatch.dylib | _dispatch_call_block_and_release
14 | UIKitCore | (Missing)
15 | Runner | AppDelegate.swift line 5main
16 | libdyld.dylib | start
复制了你的源码,在ios13上面,监听定位没有回调回来,直接获取定位是有的,但是 AMapLocationClient.setApiKey 写在main里面也获取不到,我自己调试修改位置可以了。
iOS设备能有准确的定位信息,打印出来
按照readme配置文件,从红米手机打印出来的定位信息都是null
小米手机 MI9
MUI11 9.9.25版本
Android 10打开地图定位直接闪退
AMapLocation loc = await AMapLocationClient.getLocation(false); 这句代码
An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play.
We found that your app is using a non-compliant version of the AMAP SDK which contains code to download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. If necessary, you can consult your SDK provider(s) for further information.
提交到Google play市场的App被下架了, 报告了以上问题.
platform : android-arm64 • Android 9 (API 28)
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;
[图片]
Building plugin amap_location...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1.8s
WARNING: The option setting 'android.enableR8=true' is experimental and unsupported.
The current default is 'false'
Consider disabling R8 by removing 'android.enableR8=true' from your gradle.properties before publishing your app.
FAILURE: Build failed with an exception.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
The plugin amap_location could not be built due to the issue above.
当上一个监听任务执行停止后,
如继续开启新的监听任务。
那么、、
两个监听任务又同时开启了,
如何销毁上一个监听任务呢???
1.只能停止当前监听行为
AMapLocationClient.stopLocation();
2.也不能销毁任务
void dispose() { AMapLocationClient.shutdown();//销毁任务 super.dispose(); }
要在iOS 11及以上版本使用后台定位服务, 需要实现amapLocationManager:doRequireLocationAuth: 代理方法
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.