插件:https://pub.flutter-io.cn/packages/amap_base
参考签名keystore:https://blog.csdn.net/weixin_44567104/article/details/90377912
参考解决用户key不正确或过期,md5不正确问题:https://blog.csdn.net/m00123456789/article/details/71404282?tdsourcetag=s_pctim_aiomsg
amap_base算是评分比较高的,但作者比较忙一直没更新问题也比较多
1、生成keystore文件,放到根目录下。参考https://blog.csdn.net/weixin_44567104/article/details/90377912
2、生成keystore.properties文件,加入配置
storePassword=xxx
keyPassword=xxx
keyAlias=xxx
#这里是app下的build.gradle加载,android.keystore在上级目录,就是根目录
storeFile=../android.keystore
3、app下的build.gradle加入配置
//load keystore签名配置,地图、支付等服务都要用到
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties= newProperties()
keystoreProperties.load(newFileInputStream(keystorePropertiesFile))
android {
...//签名配置
signingConfigs {
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
profile {
initWith debug
}
debug {
signingConfig signingConfigs.debug
}
release {//TODO: Add your own signing config for the release build.//Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
}
4、修改AndroidManifest.xml
5、一些问题,基本都是验签没过,sha1和packagename一定要对应上,android工程配置也要一致。用户key不正确一般加上keystore验签就行了,md5不正确应该是包名不匹配