uni-app 离线打包,放到Android studio 中显示黑屏,HX真机调试,uni.getLocation能正常返回信息,地图也能显示。在Android studio 中,uni.getLocation返回不了信息,地图显示黑屏。望回复!
- 发布:2022-07-11 09:42
- 更新:2022-07-12 17:13
- 阅读:1623
飞花飞絮 (作者) - 淡定
高德定位和高德地图都能正常显示啦!!!!!具体的操作步骤如下,希望能帮助到大家。
1 获得项目的SHA1值(如下图)
2 通过项目的包名和SHA1值,获得APPKEY,获得高德key值
3 HX中添加Maps----高德地图,把上面步骤获得的高德key值,放到里面。
4 离线打包放到Android studio中
5 app---libs文件放的arr和jar文件的下载地址:https://nativesupport.dcloud.net.cn/AppDocs/download/android
6 高德定位配置内容:https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/geolocation?id=%e9%ab%98%e5%be%b7%e5%ae%9a%e4%bd%8d
7 高德地图配置内容:https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/map?id=%e9%ab%98%e5%be%b7%e5%9c%b0%e5%9b%be
8 com.amap.api.v2.apikey 是高德上申请的key值
9 高德定位能正常显示,高德地图还是黑屏,解决方法:把libs里面的其他arr文件,都换成最新的。更新完以后报错:
What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed with multiple errors, see logs
解决方法:
Error: Attribute provider#io.dcloud.common.util.DCloud_FileProvider@authorities value=(com.android.sanyuan.dc.fileprovider) from AndroidManifest.xml:130:13-70 is also present at AndroidManifest.xml:238:13-67 value=(com.kefeng.sifa.check.dc.fileprovider). Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:128:9-136:20 to override. UniApp-Android-SiFa.app main manifest (this file), line 129
BoredApe - 有问题就会有答案。
请参考文档:https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/map确认地图APPKEY
等配置正确
-
飞花飞絮 (作者)
回复 BoredApe: Android studio 中 提示
D/ColorViewRootUtil: nav gesture mode swipeFromBottom ignore false downY 820 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=610.0, y[0]=820.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=2149679794, downTime=2149679794, deviceId=6, source=0x1002, displayId=0 } rotation 0
I/Choreographer: Skipped 2 frames! The application may be doing too much work on its main thread.
W/geoLoaction: io.dcloud.js.geolocation.amap.AMapGeoManager exception
io.dcloud.js.geolocation.baidu.BaiduGeoManager exception
I/geoListener: successType==1
I/Choreographer: Skipped 1 frames! The application may be doing too much work on its main thread.
E/UIWidgetMgr: new -- JSNWindow=_www/__uniappview.html
I/Choreographer: Skipped 1 frames! The application may be doing too much work on its main thread.
W/DpmTcmClient: read failed bytes countRead: -12022-07-11 10:06
你集成的高德地图还是百度地图
-
飞花飞絮 (作者)
回复 DCloud_Android_ST: 按着配置 我都配置好了 刚才又检查了一遍也是正确的 https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/map?id=%e9%ab%98%e5%be%b7%e5%9c%b0%e5%9b%be
2022-07-11 10:41
-
回复 飞花飞絮: https://nativesupport.dcloud.net.cn/AppDocs/usemodule/androidModuleConfig/geolocation 看下定位适配配置正确 日志显示定位都没有匹配到
2022-07-11 10:43
-
回复 DCloud_Android_ST: 1、看下aar或jar的文件大小是否存在0KB情况。2、项目是否开启混淆如果开启请关闭重试。3 插件依赖库gradle是否正确引入
2022-07-11 11:00
-
飞花飞絮 (作者)
回复 DCloud_Android_ST: 我的SHA1配置过程对吗?运行的时候提示鉴权错误信息,INVALID_USER_KEY 提示错误是:开发者发起请求时,传入的key不正确或者过期
2022-07-11 14:10
-
飞花飞絮 (作者)
回复 DCloud_Android_ST: 都是真机测试,三个真机型号分别是华为 10 Pro Android 9,OPPO R17 Android 10, vivo Y31S Android 11,显示的结果都一样,定位能显示出来,<map>组件黑屏
2022-07-11 16:13