Flutter 集成 百度地图报错:BDMapSDKException: you have not supplyed the global app context info from SDKInitializer.initialize(Context) function
昨天 18:27 浏览(12 更新于 18 小时前

需要将 android/app/src/main/AndroidManifest.xml 文件 android:name 修改为 百度的 Application


1、第一步

android/app/src/main/kotlin/com/xxx 下面创建一个自己的 MyApplication.kt,代码如下

package com.xxx.xxx

import com.baidu.mapapi.base.BmfMapApplication

class MyApplication: BmfMapApplication()


2、使用这个 MyApplication

修改文件 android/app/src/main/AndroidManifest.xml 中的 android:name 值,即:android:name="com.xxx.xxx.MyApplication"


附上官方文档:https://lbsyun.baidu.com/faq/api?title=flutter/loc/create-project/note


就是没有仔细看文档,找了半天这个错误。。。

评论(0)
发布评论
回复X
聊天室(0