Android的:在某些设备上调用链接库的方法时,我得到的NoSuchMethodError [英] Android: On some devices I get NoSuchMethodError when calling method of linked library

查看:165
本文介绍了Android的:在某些设备上调用链接库的方法时,我得到的NoSuchMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加外部库(ksoap2)到我的Andr​​oid项目。

在大多数设备上它工作正常(安卓2.3)。但别人(也Android 2.3的)我得到

  java.lang.NoSuchMethodError:org.ksoap2.serialization.SoapObject.getPropertyAsString

有什么可以这样错误的原因是什么?


解决方案

  1)有可能是多张罐子(原生库)使用相同的code,这可能会导致错误的类得到加载。2)罐子Incompatable版本,你在classpath中有罐子可能是旧版本/更新的版本。

我强烈你的情况怀疑这是第一次。我猜你有它失败的设备上本地库的两个版本。

I've added external library (ksoap2) to my Android project.

On most devices it works ok (Android 2.3). But on others (also Android 2.3) I get

java.lang.NoSuchMethodError: org.ksoap2.serialization.SoapObject.getPropertyAsString

What can be the reason of such error?

解决方案

1) There might be mulitple jars (native libraries) with same code, which may cause wrong class get loaded.

2) Incompatable version of jar, the jar you have in classpath might be older version/newer version.

I strongly suspect in your case it is first. I guess you have two versions of native libraries on the devices where it is failing.

这篇关于Android的:在某些设备上调用链接库的方法时,我得到的NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆