本文主要是介绍高德地图V3.3.2在非arm64-v8a,armeabi的CPU架构手机上运行奔溃的问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
aMap高德地图,AMap_3DMap_V3.3.2_20160525.jar,官方提供的so包只有两种:arm64-v8a,armeabi,也就是说除了arm64-v8a,armeabi两种cpu架构,其他CPU架构的手机显示高德地图都会奔溃:
java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file
...
couldn't find "libgdinamapv4sdk752.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.autonavi.amap.mapcore.MapCore.(MapCore.java:60)
at com.amap.api.mapcore.AMapDelegateImp.(AMapDelegateImp.java:291)
at com.amap.api.mapcore.j.(AMapGLSurfaceView.java:23)
at com.amap.api.mapcore.j.(AMapGLSurfaceView.java:17)
at com.amap.api.mapcore.as.a(MapFragmentDelegateImp.java:137)
at com.amap.api.maps.MapView.onCreate(MapView.java:121)
在我的magicbox(插件及而修复集一身的app)项目中,有一个方法
https://github.com/georgeyang1024/magicbox/blob/master/app/src/main/java/online/magicbox/app/PluginContext.java
在这段代码中:
//释放so文件String libPath = getFilesDir().getAbsolutePath() + "/lib/" + packageName + "_" + version;plugClassLoder = PlugClassLoder.plugClassLoderCache.get(dexPath);if (plugClassLoder==null) {ZipInputStream zipIn = null;int readedBytes = 0;byte buf[] = new byte[4096];new File(libPath).mkdirs();try {zipIn = new ZipInputStream(new BufferedInputStream(new FileInputStream(dexPath)));ZipEntry zipEntry = null;while ((zipEntry = zipIn.getNextEntry()) != null) {String name = zipEntry.getName();if (!TextUtils.isEmpty(name)) {if (name.startsWith("lib/" + Build.CPU_ABI + "/")) {String fileName = name.substring(name.lastIndexOf("/")+1,name.length());try {FileOutputStream fileOut = new FileOutputStream(new File(libPath,fileName));while ((readedBytes = zipIn.read(buf)) > 0) {fileOut.write(buf, 0, readedBytes);}fileOut.close();} catch (Exception e) {e.printStackTrace();}}}}zipIn.close();} catch (Exception e) {e.printStackTrace();} finally {try {zipIn.closeEntry();} catch (Exception e) {}}plugClassLoder = new PlugClassLoder(dexPath,context.getCacheDir().getAbsolutePath(),libPath,context.getClassLoader());}}
可见,apk文件中,只需要提取Build.CPU_ABI对应的so文件,所以非手机的so文件都是无法使用的,如果你的项目使用这个版本的高德地图,有几个对策:
博客出处
1. 等待官方提供其他cpu架构的so文件
2. 改为其他地图sdk(百度地图支持度比较好)
3. 判断兼容性,所其他操作:
if (Build.CPU_ABI.equals("armeabi") || Build.CPU_ABI.equals("arm64-v8a")) {//支持高德地图} else {//不支持高德地图}
这篇关于高德地图V3.3.2在非arm64-v8a,armeabi的CPU架构手机上运行奔溃的问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!