有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

类L安卓/widget/ImageView中没有字段mMaxWidth

我使用UniversalImageLoaderdisplayImage方法)加载图像

但它抛出NoSuchFieldException异常:

No field mMaxWidth in class L安卓/widget/ImageView; (declaration of '安卓.widget.ImageView' appears in /system/framework/framework.jar!classes3.dex)

如何修复


共 (2) 个答案

  1. # 2 楼答案

    问题已修复,但未在gradle版本中更新

    解决方案1:

    暂时不要使用

    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

    .jar file
    

    您可以将库作为zip下载,并作为模块手动添加。 我面临着同样的问题,但这在我的情况下是有效的

    对于文件更改,您可以检查此提交:f6a9615

    解决方案2:

    您可以使用JitPack使用此提交:

    在你的身体里。gradle(应用程序级)文件,添加:

    repositories {
        maven { url "https://jitpack.io" }
    }
    

    替换

    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 与:

    implementation 'com.github.nostra13:Android-Universal-Image-Loader:f6a9615868482672c3630cb7db6dcf43391e80de'