java 在 Android 4.1 之前,方法 android.graphics.PorterDuffColorFilter --- 会错误地覆盖包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42060702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 06:20:42  来源:igfitidea点击:

Before Android 4.1, method android.graphics.PorterDuffColorFilter --- would have incorrectly overridden the package

javaandroid

提问by Shapon Pal

I am using navigation drawer activity android studioand Firebase Authentication. When i going to run this app than i get this error.

我正在使用导航drawer activity android studioFirebase Authentication. 当我要运行这个应用程序时,我收到了这个错误。

  W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable

I am also using least version SDK and build tool...

我也在使用最低版本的 SDK 和构建工具...

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
}

采纳答案by marmor

Android used to run on Dalvik VM.

Android 曾经运行在Dalvik VM.

Dalvikhad a bug allowing classes to override parent's package-private methods.

Dalvik有一个错误,允许类覆盖父的包私有方法。

So when they switched to ART, they fixed this, so it no longer overrides the parent's method, Now when such a scenario is detected, it logs a warning, making sure you're aware of the behavior change.

所以当他们切换到 时ART,他们修复了这个问题,所以它不再覆盖父级的方法,现在当检测到这种情况时,它会记录一个警告,确保你知道行为的变化。

It seems that some support-libclasses (PorterDuffColorFilter, VectorDrawableCompat) have such scenario, so ARTnotifies you.

好像有些support-lib类 ( PorterDuffColorFilter, VectorDrawableCompat) 有这样的情况,所以ART通知你。

I think it's safe to ignore this, unless this is your own code, in which case I would either change the method's name, or test on Android running Dalvik(pre-4.1) and running ART(4.1+)

我认为忽略这一点是安全的,除非这是您自己的代码,在这种情况下,我要么更改方法的名称,要么在运行Dalvik(4.1 之前)和运行ART(4.1+)的Android 上进行测试