1

某些设备上,我的应用程序崩溃了

Exception java.lang.NoSuchMethodError: No virtual method decrementAndGet()I in class Lorg/apache/commons/lang3/mutable/MutableInt; or its super classes (declaration of 'org.apache.commons.lang3.mutable.MutableInt' appears in /system/framework/framework.jar:classes2.dex)

据我所知(我可能错了),Android 设备已经拥有apache commons lang3库。

我也将它包含在我的应用程序中(作为依赖项),但似乎实际加载到类路径上的不是我提供的,而是不存在该方法的旧版本。

有没有办法指示 gradle 强制使用我的 apk 中定义的apache commons lang3版本,而不是系统提供的版本?

4

1 回答 1

1

据我所知(我可能错了),Android 设备已经有 apache commons lang3 库

如果是,它是无证的。也可能是只有某些设备制造商将其加载到 zygote(所有 Android SDK 应用程序的进程都从中分叉的进程)中,而在其他制造商的其他设备上则没有问题。

似乎类路径上实际加载的不是我提供的,而是不存在该方法的旧版本

应用程序不能覆盖 zygote 中的内容。受精卵总是赢。

有没有办法指示 gradle 强制使用我的 apk 中定义的 apache commons lang3 版本,而不是系统提供的版本?

不,对不起。我建议不要使用该库。

于 2018-05-18T12:40:21.950 回答