在某些设备上,我的应用崩溃
异常 java.lang.NoSuchMethodError:类 Lorg/apache/commons/lang3/mutable/MutableInt 中没有虚方法 decrementAndGet()I;或其父类(super class)('org.apache.commons.lang3.mutable.MutableInt' 的声明出现在/system/framework/framework.jar:classes2.dex 中)
据我所知(我可能错了),Android 设备已经有了 apache commons lang3 库。
我也将它包含在我的应用程序中(作为依赖项),但似乎实际加载到类路径中的不是我提供的那个,而是一个不存在该方法的旧版本。
有没有办法指示 gradle 强制使用我的 apk 中定义的 apache commons lang3 版本,而不是系统提供的版本?
最佳答案
From what I know (I may be wrong), Android devices already have the apache commons lang3 library
如果是,则未记录。也可能是 only certain device manufacturers are loading it in the zygote (所有 Android SDK 应用程序的进程都从该进程派生),而在其他制造商的其他设备上则不是问题。
it seems the one actually loaded on the classpath is not the one I provided but an older version where that method doesn't exist
应用程序无法覆盖 zygote 中的内容。受精卵总是赢家。
Is there a way to instruct gradle to force usage of the apache commons lang3 version defined in my apk instead of the one provided by the system?
不,对不起。我建议不要使用该库。
关于android - NoSuchMethodError : No virtual method decrementAndGet 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50411325/