Git Product home page Git Product logo

amap_location_fluttify's Introduction

Logo

高德 定位组件

pub package

Dart接口基于fluttify引擎生成. dartdoc接口文档.

DEMO 与 社区

Demo QQ群
扫描二维码
或者
点击下载
加入QQ群讨论

安装:

dependencies:
  flutter:
    sdk: flutter
  amap_location_fluttify: ^x.x.x

导入:

import 'package:amap_location_fluttify/amap_location_fluttify.dart';

使用:

/// !注意: 只要是返回Future的方法, 一律使用`await`修饰, 确保当前方法执行完成后再执行下一行, 在不能使用`await`修饰的环境下, 在`then`方法中执行下一步.
/// 初始化 iOS在init方法中设置, android需要去AndroidManifest.xml里去设置, 详见 https://lbs.amap.com/api/android-sdk/gettingstarted
await AmapCore.init('ios key');

// 单次定位
if (await requestPermission()) {
  final location = await AmapLocation.fetchLocation();
  setState(() => _location = location);
}

// 连续定位
if (await requestPermission()) {
  AmapLocation.listenLocation()
    .listen((location) => setState(() => _location = location));
}

LICENSE

Copyright 2020 yohom

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

amap_location_fluttify's People

Contributors

ls-andy avatar yohom avatar zhangweiwei0326 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

amap_location_fluttify's Issues

小米6无法正常调用

插件版本
amap_location_fluttify: ^0.8.5+107df19

描述bug

] I/flutter (27059): ========getLocation start===================
[ +34 ms] D/ObjectFactory(27059): 创建对象: com_amap_api_location_AMapLocationClient__android_content_Context
[ ] W/System.err(27059): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
[ +33 ms] W/System.err(27059): at me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin$1.lambda$new$272(AmapLocationFluttifyPlugin.java:8756)
[ ] W/System.err(27059): at me.yohom.amap_location_fluttify.-$$Lambda$AmapLocationFluttifyPlugin$1$JE00UKpZAISm0a68U9a4vf_Hd04.call(Unknown Source:0)
[ ] W/System.err(27059): at me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin.onMethodCall(AmapLocationFluttifyPlugin.java:9074)
[ ] W/System.err(27059): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
[ ] W/System.err(27059): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
[ ] W/System.err(27059): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
[ ] W/System.err(27059): at android.os.MessageQueue.nativePollOnce(Native Method)
[ ] W/System.err(27059): at android.os.MessageQueue.next(MessageQueue.java:332)
[ ] W/System.err(27059): at android.os.Looper.loop(Looper.java:168)
[ ] W/System.err(27059): at android.app.ActivityThread.main(ActivityThread.java:6878)
[ ] W/System.err(27059): at java.lang.reflect.Method.invoke(Native Method)
[ ] W/System.err(27059): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
[ ] W/System.err(27059): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
[ ] I/flutter (27059): get location cause exception::::::PlatformException(Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, null)

经度纬度无法获取,报错MissingPluginException(No implementation found for method CLLocation::get_coordinate on channel com.fluttify/foundation_method)

插件版本
amap_location_fluttify: ^0.5.1+a918944
遇到bug的平台(Android/iOS)
ios
描述bug
await location.latLng 报错
复现步骤
void init() async{
if(await requestPermission()){
Location location = await AmapLocation.fetchLocation(needAddress: true);
print(await location.city);
try{
LatLng latLng = await location.latLng;
print(latLng.latitude);
}catch(e){
print(e);
}
}
}

控制台打印:
flutter: fluttify-dart: AMapLocationManager@10739597312::requestLocationWithReGeocode(['withReGeocode':true])
flutter: 深圳市
flutter: MissingPluginException(No implementation found for method CLLocation::get_coordinate on channel com.fluttify/foundation_method)
期望行为
正确获取经度纬度
截图

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G95,
locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.7)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)

ios 编译失败 有了这个模块 各种模块冲突

'AMapFoundation' uses the unencrypted 'http' protocol to transfer the
Pod. Please be sure you're in a safe network with only trusted hosts.
Otherwise, please reach out to the library author to notify them of this
security issue.

再次定位出错:kotlin.TypeCastException: null cannot be cast to non-null type com.amap.api.location.AMapLocationClient

插件版本
amap_location_fluttify: ^0.2.5+ed34f18

描述bug
在一个页面使用定位之后,关闭页面(页面mixin了AmapLocationDisposeMixin),再次进入该界面,点击定位,报以下错误

E/MethodChannel#me.yohom/amap_location_fluttify(17942): Failed to handle method call
E/MethodChannel#me.yohom/amap_location_fluttify(17942): kotlin.TypeCastException: null cannot be cast to non-null type com.amap.api.location.AMapLocationClient
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin$handlerMap$16.invoke(AmapLocationFluttifyPlugin.kt:372)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin$handlerMap$16.invoke(AmapLocationFluttifyPlugin.kt:15)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin.onMethodCall(AmapLocationFluttifyPlugin.kt:5323)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:645)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#me.yohom/amap_location_fluttify(17942): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/flutter (17942): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, null cannot be cast to non-null type com.amap.api.location.AMapLocationClient, null)
E/flutter (17942): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (17942): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (17942): <asynchronous suspension>
E/flutter (17942): #2      com_amap_api_location_AMapLocationClient.stopLocation (package:amap_location_fluttify/src/android/com/amap/api/location/AMapLocationClient.g.dart:102:75)
E/flutter (17942): <asynchronous suspension>
E/flutter (17942): #3      AmapLocation.stopLocation.<anonymous closure> (package:amap_location_fluttify/src/dart/amap_location.dart:127:41)
E/flutter (17942): #4      platform (package:foundation_fluttify/src/function/functions.dart:52:33)
E/flutter (17942): <asynchronous suspension>
E/flutter (17942): #5      AmapLocation.stopLocation (package:amap_location_fluttify/src/dart/amap_location.dart:126:12)
E/flutter (17942): #6      _DormitoryCheckPageState.stopLocation (package:smart_qfnu/pages/daily/check_in/dormitory_page.dart:375:18)
E/flutter (17942): #7      _DormitoryCheckPageState._requestCheck (package:smart_qfnu/pages/daily/check_in/dormitory_page.dart:302:5)
E/flutter (17942): <asynchronous suspension>
E/flutter (17942): #8      new Future.delayed.<anonymous closure> (dart:async/future.dart:316:39)
E/flutter (17942): #9      _rootRun (dart:async/zone.dart:1120:38)
E/flutter (17942): #10     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (17942): #11     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (17942): #12     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter (17942): #13     _rootRun (dart:async/zone.dart:1124:13)
E/flutter (17942): #14     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (17942): #15     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
E/flutter (17942): #16     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
E/flutter (17942): #17     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
E/flutter (17942): #18     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
E/flutter (17942): #19     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

复现步骤
在一个页面(页面mixin了AmapLocationDisposeMixin)使用定位之后,pop掉页面后,再次进入该界面,点击定位,报错

已尝试flutter pub upgrade和将插件完全删除重新flutter pub get

期望行为

正常定位

截图
image

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.10.14, on Mac OS X 10.15 19A602, locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.5)
[✓] Android Studio
[!] IntelliJ IDEA Ultimate Edition (version 2019.2.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.39.1)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

华为机型,版本:0.8.5+107df19,稳定闪退

插件版本
0.8.5+107df19
遇到bug的平台(Android/iOS)
Android
描述bug
其他机型暂时未发现问题
但是在测试了两台华为机型后
就会稳定出现闪退现象
机型:mate20-pro 和 荣耀P20
复现步骤
`
import 'package:amap_location_fluttify/amap_location_fluttify.dart';

.....

if (isIos) {
await AmapCore.init(Config.AMAP_KEY);
}
_loc = await AmapLocation.fetchLocation();

// 猜测是中源码的这段闪退
// invoke native method
final result = await MethodChannel('me.yohom/amap_location_fluttify').invokeMethod('com.amap.api.location.AMapLocationClient::startLocation', {"refId": refId});
`

flutter doctor
`
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.13.1-pre.94, on Microsoft Windows [Version 10.0.18362.535], locale
zh-CN)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[√] Android Studio (version 3.4)
[√] Connected device (1 available)

• No issues found!
`

和map组件冲突

D8: Program type already present: com.amap.api.mapcore.util.a$a
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.amap.api.mapcore.util.a$a
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:39)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:55)
at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:105)
at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:99)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 30 more
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.amap.api.mapcore.util.a$a
at com.android.tools.r8.utils.Reporter.a(:21)
at com.android.tools.r8.utils.Reporter.a(:7)
at com.android.tools.r8.utils.t.a(:36)
... 32 more

Finished with error: Gradle task assembleDebug failed with exit code 1

无法调用AmapCore.init方法

插件版本
amap_location_fluttify: ^0.4.2+be1d1e5
遇到bug的平台(Android/iOS)
flutter
描述bug
在pubspec.yaml中引入 amap_location_fluttify: ^0.4.2+be1d1e5,
pub get后,在使用处导import 'package:amap_location_fluttify/amap_location_fluttify.dart';
无法使用AmapCore.init

IOS 编译时报错

插件版本
amap_location_fluttify: ^0.5.1+a918944
遇到bug的平台(Android/iOS)
ios
描述bug
odule 'AMapFoundationKit' is defined in both '/Users/yanghc/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2KQUT212IJ5BP/AMapFoundationKit-2HH1E149E2LQZ.pcm' and '/Users/yanghc/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2KQUT212IJ5BP/AMapFoundationKit-2L7PJSSVEO1YW.pcm'
复现步骤

期望行为

截图
image

flutter doctor


MacBook-Pro app % flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88, locale zh-Hans-CN)
    • Flutter version 1.12.13+hotfix.5 at /usr/local/flutter
    • Framework revision 27321ebbad (2 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/yanghc/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 42.0.4
    • Dart plugin version 193.5731

[✓] VS Code (version 1.39.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.6.0

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • 297F1EBD-45F0-42E7-845B-2BD64E4A74BC • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)

• No issues found!

ios 编译不通过

插件版本

amap_location_fluttify: ^0.8.0+ea37ae9

遇到bug的平台(Android/iOS)

# ios

描述bug

# _刚装上插件的时候还能编译通过,然后在安卓模拟器上跑了一遍,回来再ios模拟器上跑就不行了...

复现步骤

    flutter run

期望行为

# 能够编译通过

截图
image

flutter doctor
image

如何判断是否正在定位中呢

如何判断是否正在定位当中呢?有个需求:当已经在定位中了,就不需要开启定位了 ,页面dispose销毁的时候 当没有正在定位 ,也不需要stopLocation

amap依赖冲突

引入依赖:
amap_location_fluttify: ^0.2.1
运行报错
Program type already present: com.amap.api.fence.DistrictItem

pod install的时候报这个错误

插件版本
amap_location_fluttify: ^0.8.0+ea37ae9
遇到bug的平台(Android/iOS)

ios

描述bug
`Error output from CocoaPods:

[!] 'AMapFoundation' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue.

Error running pod install
Error launching application on iPhone 11 Pro Max.
`
复现步骤

期望行为

截图
image

flutter doctor
`
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[✓] VS Code (version 1.39.2)
[✓] Connected device (2 available)

• No issues found!

`

第二次调用AmapLocation.fetchLocation报错

插件版本
0.4.0+82a2243

遇到bug的平台(Android/iOS)
Android

描述bug
AmapLocation.fetchLocation 第二次调用会报错
image

指向此处代码:
image

复现步骤
第二次调用 AmapLocation.fetchLocation 方法

期望行为
AmapLocation.fetchLocation 不报错

截图

flutter doctor

建议项目进行升级。

功能描述

建议项目进行升级。

Native端对应字段/方法

现在编译的时候提示 是用了一些过时的 api

`注: /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/amap_lcation_fluttify-0.5.1+a918944/android/src/main/java/me/yohom/amap_location_fluttify/AmapLocationFluttifyPlugin.java使用或覆盖了已过时的 API。

注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /usr/local/flutter/.pub-cache/hosted/pub.dartlang.org/amap_location_fluttify-0.5.1+a918944/android/src/main/java/me/yohom/amap_location_fluttify/AmapLocationFluttifyPlugi.java使用了未经检查或不安全的操作。

注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。`

定们没有返回数据 ,但日志里不停地打印位置信息。【快疯了】

插件版本
amap_location_fluttify: ^0.2.7+d2eb645
描述bug
昨天还可以正常使用,今天莫名奇妙一大推页面开始报错。一直没有想到是定位没有数据的问题。直接无意中点击到位置页面结果出来null。是什么原因没有返回位置信息,而日志里都能被打印出来?
复现步骤

期望行为

截图
image

image

flutter doctor

D8: Program type already present: com.amap.api.fence.DistrictItem

插件版本
amap_location_fluttify: ^0.3.0

描述bug

Launching lib\main.dart on 16th in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
D8: Program type already present: com.amap.api.fence.DistrictItem

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ..\build\app\intermediates\transforms\dexBuilder\debug\0.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\1.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\2.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\3.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\8.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\9.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\10.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\11.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\12.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\13.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\14.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\15.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\16.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\17.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\18.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\19.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\20.jar,
 ..\build\app\intermediates\transforms\dexBuilder\debug\21.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\22.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\23.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\24.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\25.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\26.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\27.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\28.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\29.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\30.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\31.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\32.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\33.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\34.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\35.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\36.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\37.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\38.jar, 
..\build\app\intermediates\transforms\dexBuilder\debug\39.jar, ..\build\app\intermediates\transforms\dexBuilder\debug\40.jar
Program type already present: com.amap.api.fence.DistrictItem
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

期望行为

截图
image

flutter doctor

D:\flutter>flutter doctor -v
[√] Flutter (Channel stable, v1.9.1, on Microsoft Windows [Version 10.0.17134.1006], locale zh-CN)
    • Flutter version 1.9.1 at D:\flutter
    • Framework revision c382b8e990 (3 months ago), 2019-08-18 15:22:36 -0400
    • Engine revision 5540684152
    • Dart version 2.5.0


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at D:\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: D:\Android\AndroidStudio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at D:\Android\AndroidStudio
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

ios 编译出错

测试时没有,但是想要上传构建版本至app store 或者testflight出错了。
Module 'amap_core_fluttify' not found

product-archive就会出现此错误。

0.7.1调试模式下真机无法获取到经纬度

插件版本
^0.7.0+5a112a2
遇到bug的平台(Android/iOS)
模拟器:AS自带的模拟器,系统版本8.0
真机:华为荣耀9x,系统版本9.0
描述bug
1、调试模式下(flutter run):模拟器是8.0的系统,可以获取到经纬度,但真机不行;
2、打包发布后(flutter build apk),正常。
I/flutter (27877): fluttify-dart-callback: onLocationChanged([])
I/flutter (27877): onLocationChanged::kNativeObjectPool: {com_amap_api_location_AMapLocationClient{refId: 236742784}, com_amap_api_location_AMapLocationClientOption{refId: 18844844}, com_amap_api_location_AMapLocation{refId: 100542261}}
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getCity([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getAddress([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getProvince([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getDistrict([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getLatitude([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getLongitude([])
I/flutter (27877): fluttify-dart: com.amap.api.location.AMapLocation@100542261::getAdCode([])
复现步骤

期望行为

截图

flutter doctor

await location.city 获取城市 崩溃了;

版本 0.8.6

*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c forwarding + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 Runner 0x00000001008153e7 __61-[AmapLocationFluttifyPlugin initWithFlutterPluginRegistrar:]_block_invoke_45 + 263
6 Runner 0x000000010082368a -[AmapLocationFluttifyPlugin handleMethodCall:result:] + 346
7 Flutter 0x0000000100e34f95 __45-[FlutterMethodChannel setM<…>

AmapLocation.fetchLocation 限制获取一次问题

插件版本
amap_location_fluttify: ^0.7.0+5a112a2
遇到bug的平台(Android/iOS)
Android
描述bug
AmapLocation.fetchLocation app安装后仅首次获取有效

杀死app进程后,再进入app 调用方法 依然无效

期望行为
个人认为
AmapLocation.fetchLocation 这个获取一次 应该是 一个app生命周期内的一次。
不应该是 仅首次获取有效
这个方法

stopLocation以后重新listenLocation,同一个数据会出现多次。

^0.8.0+ea37ae9

Android

测试方法
example,只打印onLocationChanged的结果,先开一次onLocationChanged,然后stop,再开启一次onLocationChanged,每秒中会打印两次。

_androidLocationDelegate = null;

感觉这里_androidLocationDelegate = null; 并没有释放,

await _androidClient.setLocationListener(_androidLocationDelegate);

这里会新建一个,导致同一个Location会触发多次。
加上这句话后await _androidClient.unRegisterLocationListener(_androidLocationDelegate);还是没用。我现在只能注释掉//_androidLocationDelegate = null;

使用location.altitude拿不到海拔

插件版本
0.2.7
描述bug
使用location.altitude拿不到海拔
复现步骤
调用locationChanged: (location) async{};方法,只拿到了经纬度,没有海拔
期望行为
可以获取海拔
截图
flutter doctor

0.8.1编译报错

插件版本
^0.8.1+865eb83
遇到bug的平台(Android/iOS)
Android
描述bug
编译报错:
错误: 无法将类 AmapLocationFluttifyPlugin中的构造器 AmapLocationFluttifyPlugin应用到给定类型;
flutterEngine.getPlugins().add(new me.yohom.amap_location_fluttify.AmapLocationFluttifyPlugin());
^
需要: BinaryMessenger
找到: 没有参数
原因: 实际参数列表和形式参数列表长度不同
1 个错误

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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
    复现步骤

期望行为

截图

flutter doctor

安卓打包apk失败

插件版本
目前github最新版
遇到bug的平台(Android/iOS)
Android
描述bug
flutter build apk

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/macbook/.pub-cache/hosted/pub.dartlang.org/amap_core_fluttify-0.5.3+356f11c/android/build.gradle' line: 48

* What went wrong:
A problem occurred evaluating root project 'amap_core_fluttify'.
> Cannot convert a null value to an object of type Dependency.
  The following types/formats are supported:
    - Instances of Dependency.
    - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
    - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
    - FileCollections, for example files('some.jar', 'someOther.jar').
    - Projects, for example project(':some:project:path').
    - ClassPathNotation, for example gradleApi().

  Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

* 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_core_fluttify could not be built due to the issue above.

安卓8以上后台定位功能

功能描述
安卓8以上后台定位功能
Native端对应字段/方法
AMapLocationClient.disableBackgroundLocation(boolean removeNotification)
AMapLocationClient.enableBackgroundLocation(int notificationId, Notification notification)
源码的amap的location sdk示例有(在/app/src/main/java/com/amap/location/demo/Location_BackGround_Activity.java中)
image
参考文档:http://amappc.cn-hangzhou.oss-pub.aliyun-inc.com/lbs/static/unzip/Android_Location_Doc/index.html

谢谢大佬!!

设置超时时间的参数应该是int 而不是long

插件版本
0.8.1
遇到bug的平台(Android/iOS)
Android
描述bug
com.amap.api.location.AMapLocationClientOption::setHttpTimeOut
接收的参数 “var1” 类型应该是 int 而不是 long
在0.8.0 里面解决了这个问题,但是在 0.8.1 又出现这个问题了
复现步骤

期望行为

截图

flutter doctor

升级flutter version v1.12.13和 amap_location_fluttify: "0.5.1+a918944"后debug编译时报错

flutter version v1.12.13+hotfix.6
amap_core_fluttify:
version: "0.2.4+bb1f005"
amap_location_fluttify:
version: "0.5.1+a918944"

平台(Android)

描述bug

  • What went wrong:
    Execution failed for task ':app:preDebugBuild'.

Android dependency 'androidx.fragment:fragment' has different version for the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution

  • Where:
    Build file 'C:\src\flutter.pub-cache\hosted\pub.flutter-io.cn\amap_core_fluttify-0.2.4+bb1f005\android\build.gradle' line: 47

  • What went wrong:
    A problem occurred evaluating root project 'amap_core_fluttify'.

Cannot convert a null value to an object of type Dependency.
The following types/formats are supported:
- Instances of Dependency.
- String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
- Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
- FileCollections, for example files('some.jar', 'someOther.jar').
- Projects, for example project(':some:project:path').
- ClassPathNotation, for example gradleApi().

复现步骤
升级flutter version v1.12.13和 amap_location_fluttify: "0.5.1+a918944"后debug编译时报错

flutter doctor :
[√] Flutter (Channel unknown, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18362.476], locale zh-CN)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2019.1)
[√] Connected device (1 available)

! Doctor found issues in 2 categories.

MapController 无法在 location 的locationChanged方法里面调用

Map 和 location 配合使用出现如下问题

// flutter 版本
Flutter 1.9.1+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aedbb1835 (11 天前) • 2019-10-17 08:37:27 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0

// 插件版本 
amap_map_fluttify: ^0.2.4+9922976
amap_location_fluttify: ^0.2.3+9922976
.....
.....      
body: AmapView(
        onMapCreated: (controller) async {
          _controller = controller;
         // 如果此处用 await controller.setZoomLevel(18); 下面的代码都无效
          controller.setZoomLevel(18);
          await controller.setCenterCoordinate(36.10453694661458, 120.40822835286458);
          AmapLocation.startLocation(
            once: false,
            locationChanged: locationChanged: this._startLocation        
          ); 
.....
.....
  void _startLocation(Location location) async {
    double latitude = await location.latitude;
    double longitude = await location.longitude;
    print('***********');
    print("latitude: $latitude");
    print("longitude: $longitude");
   // 当前能改变经纬度 但是调用地图的 controller 是无效的
    await _controller?.setCenterCoordinate(36.10453694661458, 120.40822835286458);
  }

添加依赖后编译报错

我引入的依赖:
amap_location_fluttify: ^0.2.1+e0ef7a2

编译时出现的错误:

* Where:
Build file '/Users/am/dev/env/flutter/.pub-cache/hosted/pub.flutter-io.cn/amap_core_fluttify-0.0.6/android/build.gradle' line: 46
* What went wrong:
A problem occurred evaluating root project 'amap_core_fluttify'.
> Cannot convert a null value to an object of type Dependency.
  The following types/formats are supported:
    - Instances of Dependency.
    - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
    - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
    - FileCollections, for example files('some.jar', 'someOther.jar').
    - Projects, for example project(':some:project:path').
    - ClassPathNotation, for example gradleApi().

  Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

flutter doctor:

Flutter (Channel dev, v1.10.14, on Mac OS X 10.15 19A602, locale zh-Hans-CN)

高德IOS定位慢

插件版本
0.3.0+8cf796c
描述bug
ios定位慢 市区5~10s才能返回定位地址
复现步骤
AmapLocation.startLocation单次定位
期望行为
定位返回快,或者可以提供接口只返回经纬度 节约获取地址的时间
截图

flutter doctor

0.8.0以上版本iOS出现Error running pod install

插件版本0.8.0 0.8.1 0.8.2
编译iOS时报错

Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: MHK5R57ZM4
Running pod install...
CocoaPods' output:

Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  - Flutter
  - amap_core_fluttify
  - amap_location_fluttify
  - flutter_image_compress
  - flutter_local_notifications
  - foundation_fluttify
  - image_picker
  - permission_handler
  - shared_preferences
  - shared_preferences_macos
  - shared_preferences_web

Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `amap_core_fluttify` from `.symlinks/plugins/amap_core_fluttify/ios`
-> Fetching podspec for `amap_location_fluttify` from `.symlinks/plugins/amap_location_fluttify/ios`
-> Fetching podspec for `flutter_image_compress` from `.symlinks/plugins/flutter_image_compress/ios`
-> Fetching podspec for `flutter_local_notifications` from `.symlinks/plugins/flutter_local_notifications/ios`
-> Fetching podspec for `foundation_fluttify` from `.symlinks/plugins/foundation_fluttify/ios`
-> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
-> Fetching podspec for `permission_handler` from `.symlinks/plugins/permission_handler/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `shared_preferences_macos` from `.symlinks/plugins/shared_preferences_macos/ios`
-> Fetching podspec for `shared_preferences_web` from `.symlinks/plugins/shared_preferences_web/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_8_f_f.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.6.1/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_0_3_9.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/9/AMapLocation/2.6.4/AMapLocation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: all_pods_versions_5_d_c.txt exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/5/d/c/Mantle/2.1.0/Mantle.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.6.0/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/0/3/9/AMapLocation/2.6.3/AMapLocation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.6.1/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.6.0/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.9/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.8/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.7/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.6/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.5/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.4/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.3/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.2/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.1/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.5.0/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.4.3/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.4.2/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.4.1/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/8/f/f/AMapFoundation/1.4.0/AMapFoundation.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/5/d/c/Mantle/2.1.0/Mantle.podspec.json exists! Returning local because checking is only perfomed in repo update
  CDN: trunk Relative path: Specs/5/d/c/Mantle/2.1.0/Mantle.podspec.json exists! Returning local because checking is only perfomed in repo update

Comparing resolved specification to the sandbox manifest
  A AMapFoundation
  A AMapLocation
  A Flutter
  A Mantle
  A amap_core_fluttify
  A amap_location_fluttify
  A flutter_image_compress
  A flutter_local_notifications
  A foundation_fluttify
  A image_picker
  A permission_handler
  A shared_preferences
  A shared_preferences_macos
  A shared_preferences_web

Downloading dependencies

-> Installing AMapFoundation (1.6.0)
  > Copying AMapFoundation from `/Users/qg/Library/Caches/CocoaPods/Pods/Release/AMapFoundation/1.6.0-bc2f6` to `Pods/AMapFoundation`

-> Installing AMapLocation (2.6.3)
  > Copying AMapLocation from `/Users/qg/Library/Caches/CocoaPods/Pods/Release/AMapLocation/2.6.3-dc2c4` to `Pods/AMapLocation`

-> Installing Flutter (1.0.0)

-> Installing Mantle (2.1.0)
  > Copying Mantle from `/Users/qg/Library/Caches/CocoaPods/Pods/Release/Mantle/2.1.0-2fa75` to `Pods/Mantle`

-> Installing amap_core_fluttify (0.0.1)

-> Installing amap_location_fluttify (0.0.1)

-> Installing flutter_image_compress (0.0.1)

-> Installing flutter_local_notifications (0.0.1)

-> Installing foundation_fluttify (0.0.1)

-> Installing image_picker (0.0.1)

-> Installing permission_handler (4.0.0)

-> Installing shared_preferences (0.0.1)

-> Installing shared_preferences_macos (0.0.1)

-> Installing shared_preferences_web (0.0.1)
  - Running pre install hooks
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (/Users/qg/WorkSpace/git/noodle_flutter/ios/Pods/AMapFoundation/AMapFoundationKit.framework and /Users/qg/WorkSpace/git/noodle_flutter/ios/Pods/AMapLocation/AMapLocationKit.framework)

/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:590:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:158:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods:

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Finished with error: Error running pod install

插件版本改回0.7.0及以下就能解决

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale zh-Hans-CN)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.4)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

定位结果为0,0

插件版本
amap_all_fluttify: ^0.9.0
遇到bug的平台(Android/iOS)
Android
描述bug
定位的结果为 0,0
复现步骤
这是我获取定位的代码

获取 Future

   ///请求定位
  _reqPosition() async {
    if (await PermissionUtil.req(PermissionGroup.location)) {
      var location = AmapLocation.fetchLocation();
      return location;
    }else {
      showToast('需要定位权限');
      throw Exception(["需要定位权限"]);
    }
  }

  
  ///解析定位结果
  updatePosition() async {
    var location = await _reqPosition();
    _latLng = await location.latLng;
    print('定位: $_latLng');
    _locationTime ++ ;
    notifyListeners();
  }

运行日志 我将打印部分加粗

Performing hot restart...
Syncing files to device MI CC 9e...
Restarted application in 2,099ms.
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::mapType(['var1':0])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::zoomControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::compassEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::scaleControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::zoomGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::scrollGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::rotateGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::tiltGesturesEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.model.CameraPosition::fromLatLngZoom(['var1':3.0])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@191931581::camera([])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::mapType(['var1':0])
I/flutter (30141): fluttify-dart: com.amap.api.maps.MapView@0::onCreate([])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::zoomControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::compassEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::scaleControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::zoomGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClient@192017349::setLocationListener([])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::scrollGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::rotateGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClientOption@250057803::setOnceLocation(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::tiltGesturesEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClientOption@250057803::setLocationMode([])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClientOption@250057803::setSensorEnable(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.model.CameraPosition::fromLatLngZoom(['var1':3.0])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClient@192017349::setLocationOption([])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@261492950::camera([])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocationClient@192017349::startLocation([])
I/flutter (30141): fluttify-dart-callback: onLocationChanged([])
I/flutter (30141): onLocationChanged::kNativeObjectPool: {com_amap_api_maps_AMapOptions{refId: 191931581}, com_amap_api_maps_model_LatLng{refId: 1924730209}, com_amap_api_maps_model_CameraPosition{refId: 139848370}, com_amap_api_maps_AMapOptions{refId: 261492950}, com_amap_api_location_AMapLocationClient{refId: 192017349}, com_amap_api_location_AMapLocationClientOption{refId: 250057803}, com_amap_api_maps_model_CameraPosition{refId: 237643323}, com_amap_api_location_AMapLocation{refId: 246137079}}
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocation@246137079::getLatitude([])
I/flutter (30141): fluttify-dart: com.amap.api.location.AMapLocation@246137079::getLongitude([])

I/flutter (30141): 定位: LatLng{lat: 0.0, lng: 0.0}

I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::mapType(['var1':0])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::zoomControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::compassEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::scaleControlsEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::zoomGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::scrollGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::rotateGesturesEnabled(['var1':true])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::tiltGesturesEnabled(['var1':false])
I/flutter (30141): fluttify-dart: com.amap.api.maps.model.CameraPosition::fromLatLngZoom(['var1':3.0])
I/flutter (30141): fluttify-dart: com.amap.api.maps.AMapOptions@12843650::camera([])
I/flutter (30141): didChangeAppLifecycleState: AppLifecycleState.inactive
I/flutter (30141): didChangeAppLifecycleState: AppLifecycleState.paused
I/flutter (30141): fluttify-dart: com.amap.api.maps.MapView@0::onPause([])

期望行为
在打印日志中显示,定位的结果为 定位: LatLng{lat: 0.0, lng: 0.0},没有显示出正确的定位信息,希望显示正确的定位信息.
flutter doctor
使用的android studio

[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.476], locale zh-CN)
    • Flutter version 1.12.13+hotfix.5 at D:\mobile\flutter
    • Framework revision 27321ebbad (8 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at D:\mobile\android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_SDK_ROOT = D:\mobile\android-sdk
    • Java binary at: D:\mobile\studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[√] Android Studio (version 3.5)
    • Android Studio at D:\mobile\studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at D:\tools\IntelliJ IDEA 2019.3
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[√] Connected device (1 available)
    • MI CC 9e • b580f4e6c631 • android-arm64 • Android 9 (API 28)

Google Play 被下架

插件版本
0.4.1+82a2243
遇到bug的平台(Android/iOS)
Android
描述bug
Google Play 被下架
Google 邮件内容

Hi Developers at XXXX,

After a recent review, T Two, your.package.name (Version Code 23), has been removed from Google Play due to a policy violation. This app won’t be available to users until you submit a compliant update.

Issue: Violation of Malicious Behavior policy

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.

Next steps: Submit your updated app for another review

Read through the Malicious Behavior policy for more details.
Make changes to bring your app into compliance. Be sure to address the issue identified above. In addition to your Production release, if you have other release types that you use for testing and/or quality assurance checks (e.g. Internal test, Closed, Open), please make sure to update those tracks as well.
Check that your app is compliant with all other Developer Program Policies. Additional enforcement could occur if there are further policy violations.
Sign in to your Play Console and submit the policy compliant update.
You may also be interested in exploring Dynamic Delivery as an alternative implementation.

If approved, your app will again be available with all installs, ratings, and reviews intact.

If you’ve reviewed the policy and feel this decision may have been in error, please reach out to our policy support team. We’ll get back to you within 2 business days.

Please help us improve the developer experience by completing this two question survey.

Regards,

The Google Play Team

也许可行的解决方法
https://ask.dcloud.net.cn/question/80005
作者可以帮忙确认一下高德sdk的版本吗?
谢谢

无法找到LatLng这个类

插件版本
最新版本
描述bug
再源码中看到LatLng这个类属于amap_core_fluttify,但是无法获取到,进而无法拿到相应的经纬度数据
复现步骤

期望行为

截图

flutter doctor

鉴权错误信息

插件版本
version: "0.2.1+38df15a"
描述bug
SHA1 和包名都对的 安卓上面跑提示说鉴权错误,大佬怎么回事呢?
复现步骤

期望行为

截图
AndroidManifest中的设置这个就行了吧?

    <meta-data
        android:name="我的包名=高德地图应用包名"
        android:value="高德地图appkey"/>

flutter doctor

0.8.3 Android编译错误

插件版本
0.8.3
遇到bug的平台(Android/iOS)
Android

报错内容

注: /Users/qg/.pub-cache/hosted/pub.flutter-io.cn/amap_location_fluttify-0.8.3+4d92ce0/android/src/main/java/me/yohom/amap_location_fluttify/AmapLocationFluttifyPlugin.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/qg/.pub-cache/hosted/pub.flutter-io.cn/amap_location_fluttify-0.8.3+4d92ce0/android/src/main/java/me/yohom/amap_location_fluttify/AmapLocationFluttifyPlugin.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
D8: Program type already present: com.amap.api.fence.DistrictItem$1
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: com.amap.api.fence.DistrictItem$1
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 34 more
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.amap.api.fence.DistrictItem$1
at com.android.tools.r8.utils.Reporter.a(:21)
at com.android.tools.r8.utils.Reporter.a(:7)
at com.android.tools.r8.utils.t.a(:36)
... 36 more

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeExtDexDebug'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: com.amap.api.fence.DistrictItem$1
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

  • 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 19s
[!] The shrinker may have failed to optimize the Java bytecode.
To disable the shrinker, pass the --no-shrink flag to this command.
To learn more, see: https://developer.android.com/studio/build/shrink-code
Finished with error: Gradle task assembleDebug failed with exit code 1

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[✓] Connected device (1 available)

• No issues found!

打包出现错误

插件版本
我的版本是 0.7.0+5a112a2,我在执行Android打包时遇到了下面这些错误信息:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/jiangjuhong/.pub-cache/hosted/pub.flutter-io.cn/amap_core_fluttify-0.4.0+e26c0fa/android/build.gradle' line: 47

* What went wrong:
A problem occurred evaluating root project 'amap_core_fluttify'.
> Cannot convert a null value to an object of type Dependency.
  The following types/formats are supported:
    - Instances of Dependency.
    - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
    - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
    - FileCollections, for example files('some.jar', 'someOther.jar').
    - Projects, for example project(':some:project:path').
    - ClassPathNotation, for example gradleApi().

  Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

* 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 614ms


The plugin amap_core_fluttify could not be built due to the issue above.

下载了你的这个amap_locationAPP后效果是一样的,你可以验证下华为手机P30 系统是10 二次定位数据没返回,失败

下载了你的这个amap_locationAPP后效果是一样的,你可以验证下华为手机P30 系统是10
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.657], locale zh-CN)
• Flutter version 1.12.13+hotfix.8 at D:\Xin\flutter
• Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at D:\Xin\AndroidSdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = D:\Xin\AndroidSdk
• Java binary at: D:\Xin\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.

[!] Android Studio (version 2.2)
• Android Studio at D:\Xin\AndroidStudio2.2.3\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_76-release-b03)

[√] Android Studio (version 3.6)
• Android Studio at D:\Xin\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
• ELE AL00 • 8KE5T19301003594 • android-arm64 • Android 10 (API 29)
environment:
sdk: ">=2.3.0 <3.0.0"
#定位
amap_location_fluttify: ^0.8.7+1053dca

主页
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await enableFluttifyLog(true); // 关闭log
await AmapService.init(iosKey: 'id',androidKey: 'id');
runApp(new MyApp());
}
定位页
initLocation() async {
final location = await AmapLocation.fetchLocation(
needAddress: true, mode: LocationAccuracy.High);
if (location != null && (await location.latLng) != null) {
address = await location.address;
await location.latLng.then((it) {
setState(() {
longitude = it.longitude;
latitude = it.latitude;
});
});
}
}
然后关闭app到桌面后提示“EGLNativeWindowType 0x7d5d9c2010 disconnect failed”
之后再进入定位页
initLocation() async {
final location = await AmapLocation.fetchLocation(
needAddress: true, mode: LocationAccuracy.High);
if (location != null && (await location.latLng) != null) {
address = await location.address;
await location.latLng.then((it) {
setState(() {
longitude = it.longitude;
latitude = it.latitude;
});
});
}
}
这里返回的经纬度和地址为空

我加了AmapLocationDisposeMixin后,
fluttify-java: com.amap.api.location.AMapLocationClient@114144016::onDestroy()
W/System.err(14882): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.amap.api.location.AMapLocationClient.onDestroy()' on a null object reference

[android] 没有定位结果

版本:0.8.3+4d92ce0

if (await requestPermission()) {
  print('=====');
  final location = await AmapLocation.fetchLocation();
  print('=====$location');
}
fluttify-dart: com.amap.api.location.AMapLocationClient@127123182::setLocationListener([])
fluttify-dart: com.amap.api.location.AMapLocationClientOption@136904591::setOnceLocation(['var1':true])
fluttify-dart: com.amap.api.location.AMapLocationClientOption@136904591::setLocationMode([])
fluttify-dart: com.amap.api.location.AMapLocationClientOption@136904591::setSensorEnable(['var1':true])
fluttify-dart: com.amap.api.location.AMapLocationClient@127123182::setLocationOption([])
fluttify-dart: com.amap.api.location.AMapLocationClient@127123182::startLocation([])

print('=====$location');没看到这个打印
没看到
fluttify-dart-callback: onLocationChanged([])
demo有上面这个打印

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.