当前位置:网站首页>Flutter 集成 amap_flutter_location
Flutter 集成 amap_flutter_location
2022-07-04 08:24:00 【高凤森】
Flutter 集成 amap_flutter_location
今天用 amap_flutter_location 写了个demo,过程中一直报:INVALID_USER_SCODE
,error_cod
: 1008,下面给大家看下主要流程
一、注册账号
- 在高德开放平台注册开发者账号
- 创建应用,获取 app key
二、配置
- 导入 amap_flutter_location
- gradle build 成功后,将 amap_flutter_location -> build.gradle -> android -> dependencies 节点下,引入插件的
compileOnly
修改为api
例如:
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 16
}
lintOptions {
disable 'InvalidPackage'
}
dependencies {
//compileOnly 'com.amap.api:location:5.6.0'
api 'com.amap.api:location:5.6.0'
}
}
- 清单文件下配置相关权限,并在运行时请求必要权限,具体请参考:高德开放平台
<!-- 这是我自己配置的,亲测可行 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
- 在清单文件
application
节点下导入下面的service
ps: 注意,如果没有把compileOnly
修改为api
,这里就会报错
<service android:name="com.amap.api.location.APSService" />
三、使用
使用的话参考 文档 就足够了,主要是要注意配置的信息是否正确。下面列几个坑点
- 生成 app key 的时候需要证书的 SHA1 值,这里我使用通过命令行生成的 keystore 死活不行,最后通过Android Studio生成的就可以了(怀疑是别名的问题)
- 报错:INVALID_USER_SCODE,报这个错主要就是配置问题。先检查 SHA1 值是否正确;确保没有问题后,在检查配置的包名有没有问题;不对的话,看看自己有没有配置service;最后还不行,就看看 官方回复
边栏推荐
- snipaste 方便的截图软件,可以复制在屏幕上
- [go basics] 1 - go go
- Redis sentinel mechanism
- OKR vs. KPI 一次搞清楚这两大概念!
- PHP converts seconds to timestamps - PHP
- NewH3C——ACL
- Common components of flask
- Unity-写入Word
- DM8 uses different databases to archive and recover after multiple failures
- Difference between static method and non static method (advantages / disadvantages)
猜你喜欢
【Go基础】1 - Go Go Go
墨者学院-Webmin未经身份验证的远程代码执行
墨者学院-phpMyAdmin后台文件包含分析溯源
Newh3c - routing protocol (RIP, OSPF)
Ecole bio rushes to the scientific innovation board: the annual revenue is 330million. Honghui fund and Temasek are shareholders
[go basics] 2 - go basic sentences
Unity text superscript square representation +text judge whether the text is empty
[CV] Wu Enda machine learning course notes | Chapter 9
SSRF vulnerability exploitation - attack redis
弈柯莱生物冲刺科创板:年营收3.3亿 弘晖基金与淡马锡是股东
随机推荐
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Redis 哨兵机制
Devops Practice Guide - reading notes (long text alarm)
真空介电常数和真空磁导率究竟是由什么决定的?为何会存在这两个物理量?
Leetcode 23. Merge K ascending linked lists
墨者学院-Webmin未经身份验证的远程代码执行
Group programming ladder race - exercise set l2-002 linked list de duplication
es6总结
zabbix監控系統自定義監控內容
Use preg_ Match extracts the string into the array between: & | people PHP
[test de performance] lire jmeter
Question 49: how to quickly determine the impact of IO latency on MySQL performance
ZABBIX monitoring system deployment
AcWing 244. Enigmatic cow (tree array + binary search)
Flask 常用组件
线性代数1.1
How to improve your system architecture?
@Role of requestparam annotation
What does range mean in PHP
Go h*ck yourself:online reconnaissance (online reconnaissance)