前言
在开发中我们会使用各种各样的开发SDK,地图SDK是最常用的一个,本文主要收集小伙伴们遇到的高德地图的问题,欢迎下伙伴们参与进来,可以把问题和解决方法发送到411437734@qq.com邮箱(当然也欢迎大家发布问题嘿嘿),
问题1
No implementation found for long com.autonavi.amap.mapcore.MapCore.nativeNewInstance(java.lang.String, java.lang.String)
这个问题就是so库调用出现问题,解决so问题就可以了
返回错误
E/art: No implementation found for long com.autonavi.amap.mapcore.MapCore.nativeNewInstance(java.lang.String, java.lang.String) (tried Java_com_autonavi_amap_mapcore_MapCore_nativeNewInstance and Java_com_autonavi_amap_mapcore_MapCore_nativeNewInstance__Ljava_lang_String_2Ljava_lang_String_2)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tlh.gczp, PID: 23100
java.lang.RuntimeException: Unable to start activity ComponentInfo{****}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.amap.api.navi.AMapNavi.addAMapNaviListener(com.amap.api.navi.AMapNaviListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2444)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.amap.api.navi.AMapNavi.addAMapNaviListener(com.amap.api.navi.AMapNaviListener)' on a null object reference
at com.******.NavigateActivity.onCreate(NavigateActivity.java:43)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2397)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
解决方法
造成原因是我们引用的第三方工厂使用arm64-v8a、x86/x86_64等so库,而高德中没有提供相关的SO库(https://lbs.amap.com/dev/ticket#/faq/291)
解决方法(https://lbs.amap.com/dev/ticket#/faq/291)
defaultConfig {
......
ndk {
abiFilters "armeabi"
}
}
如上处理依然报错
检查下是否有百度相关的so库,与高德的冲突,例如我项目集成的环信SDK easyui工厂添加了百度定位,删除掉百度定位OK,正常跑起来的!!!!
欢迎小伙伴们踊跃参加,谢谢!!