Android Glide无法解析方法';签名(StringSignature)和#x27;
我正在使用glide 4.3.1 我想调用签名方法,但没有出现 我的代码Android Glide无法解析方法';签名(StringSignature)和#x27;,android,caching,signature,android-glide,Android,Caching,Signature,Android Glide,我正在使用glide 4.3.1 我想调用签名方法,但没有出现 我的代码 Glide.with(context).load(context.getFilesDir().getPath() + "/" + imgName).into(imgView); 我想这样做 Glide.with(context).load(context.getFilesDir().getPath() + "/" + imgName).signature(new StringSignature("someVersion"
Glide.with(context).load(context.getFilesDir().getPath() + "/" + imgName).into(imgView);
我想这样做
Glide.with(context).load(context.getFilesDir().getPath() + "/" + imgName).signature(new StringSignature("someVersion")).into(imgView);
我正在使用android studio,当我将鼠标放在签名方法上时,我看到一条消息:无法解析方法“签名(StringSignature)”
我的身材格拉德尔:
dependencies {
compile 'com.github.bumptech.glide:glide:4.3.1'
}
据我所知,您为Glide编写了扩展类,但您使用的是基本Glide类。你应该使用
在glide v4中,您应该使用
ObjectKey
(用于文件和URL)或MediaStoreSignature
(用于媒体内容),而不是StringSignature
,您需要将其放入应用程序中
实现'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor'com.github.bumptech.glide:compiler:4.9.0'
在你的代码中,你必须把这个
GlideApp.with(context)
.load(file.getAbsolutePath())
.signature(new ObjectKey(file.getPath() + file.lastModified()))
.fitCenter()
// caches only the final image, after reducing the resolution
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(view);
GlideApp.with(context)
.load(file.getAbsolutePath())
.signature(new ObjectKey(file.getPath() + file.lastModified()))
.fitCenter()
// caches only the final image, after reducing the resolution
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(view);