gpt4 book ai didi

android - Glide crash 因为 context 4.3.1

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:07:35 24 4
gpt4 key购买 nike

在新版本的 Glide 4.3 中,我尝试使用它,但无论何时使用它以及传递给它的任何上下文,它都会崩溃。

这是给我看的错误

   java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)"

这是我试过的代码:

Glide.with(getApplicationContext()).
load(url)
.into(imageView);

   Glide.with(getContext()).
load(url)
.into(imageView);

它给了我那个警告

W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored

和gradle中lib中的代码

compile 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'

更新1:通过添加一个扩展 AppGlideModule 的类来解决警告

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}

但同样的错误仍然存​​在

最佳答案

请在您的 AppGlideModule 类中添加以下方法

@Override
public boolean isManifestParsingEnabled() {
return false;
}

To maintain backward compatibility with Glide v3’s GlideModules, Glide still parses AndroidManifest.xml files from both the application and any included libraries and will include any legacy GlideModules listed in the manifest. Although this functionality will be removed in a future version, we’ve retained the behavior for now to ease the transition. If you’ve already migrated to the Glide v4 AppGlideModule and LibraryGlideModule, you can disable manifest parsing entirely. Doing so can improve the initial startup time of Glide and avoid some potential problems with trying to parse metadata. To disable manifest parsing, override the isManifestParsingEnabled() method in your AppGlideModule implementation

检查:http://bumptech.github.io/glide/doc/configuration.html

关于android - Glide crash 因为 context 4.3.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47327760/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com