当前位置:网站首页>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;最后还不行,就看看 官方回复
边栏推荐
- SSRF vulnerability exploitation - attack redis
- [CV] Wu Enda machine learning course notes | Chapter 9
- Activiti common operation data table relationship
- Unity-Text上标平方表示形式+text判断文本是否为空
- Azure ad domain service (II) configure azure file share disk sharing for machines in the domain service
- 【性能測試】一文讀懂Jmeter
- 根据数字显示中文汉字
- 线性代数1.1
- Sort by item from the list within the list - C #
- 团体程序设计天梯赛-练习集 L1-006 连续因子
猜你喜欢
线性代数1.1
ES6 summary
[go basics] 2 - go basic sentences
DM database password policy and login restriction settings
根据数字显示中文汉字
Mouse over to change the transparency of web page image
Chrome is set to pure black
Sqli labs download, installation and reset of SQL injection test tool one of the solutions to the database error (# 0{main}throw in d:\software\phpstudy_pro\www\sqli labs-...)
A method for detecting outliers of data
JVM中堆概念
随机推荐
Redis 哨兵机制
zabbix監控系統自定義監控內容
deno debugger
[untitled] 2022 polymerization process analysis and polymerization process simulation examination
Fault analysis | MySQL: unique key constraint failure
如何用MOS管来实现电源防反接电路
SQL statement view SQL Server 2005 version number
Using the rate package for data mining
线性代数1.1
OKR vs. KPI figure out these two concepts at once!
Leetcode 146. LRU 缓存
JVM中堆概念
团体程序设计天梯赛-练习集 L2-002 链表去重
促进OKR落地的工作总结该如何写?
If the array values match each other, shuffle again - PHP
Sqli labs download, installation and reset of SQL injection test tool one of the solutions to the database error (# 0{main}throw in d:\software\phpstudy_pro\www\sqli labs-...)
@Role of pathvariable annotation
[performance test] read JMeter
Snipaste convenient screenshot software, which can be copied on the screen
Leetcode 23. Merge K ascending linked lists