Glide升级到4.x版本遇到的问题
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.
依赖的glide版本是
// glide
implementation ('com.github.bumptech.glide:glide:4.8.0') {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
查阅官方文档之后发现,4.x版本的Glide在接口调用和4.x之前有很大区别。
在github的issue里,找到如下答案:
To use the generated API in your application, you need to perform two steps:
1. Add a dependency on Glide’s annotation processor:
```
repositories {
mavenCentral()
}
dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
```
2. Include a [`AppGlideModule`]
```
package com.example.myapp;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}
```
You’re not required to implement any of the methods in `AppGlideModule` for the
API to be generated. You can leave the class blank as long as it
extends `AppGlideModule` and is annotated with `@GlideModule`.
按照文档,添加AppGlideModule之后,问题解决。
asBitmap() 接口找不到了
查阅文档后发现是4.x的接口变动了
for anyone came here and still have this issue, I found the way to fix it,
you must add the asBitmap() right After with() and it will work just like old times
代码做如下修改后解决:
// Put asBitmap() right after Glide.with(context) for glide 4.x
Glide.with(mActivity).asBitmap()
.load(url)
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Bitmap> target, boolean b) {
return false;
}
@Override
public boolean onResourceReady(Bitmap bitmap, Object o, Target<Bitmap> target, DataSource dataSource, boolean b) {
Log.d(TAG, "get serialNo : " + serialNo + " cover successful!");
if (mPreviewingFaceMap.containsKey(serialNo)) {
mPreviewingFaceMap.get(serialNo).activityCoverBitmap = bitmap;
}
return false;
}
}
).submit();
Glide升级到4.x版本遇到的问题的更多相关文章
- centos7 升级内核到最新版本
centos7 从问世以来,官网提供的镜像始终是3.10 版本,该版本最大的一个问题是对硬件驱动(尤其是无线网卡)的支持不是很好,本人亲测>5种机型,无线网卡均无法正常使用,如果是非主流机型,手 ...
- Xcode 升级成Xcode 8 版本以后,出现 Signing for "sqlite3--test" requires a development team. 问题的解决
升级xcode到8版本以后,工程文件会出现以下提示 解决办法就是,点击Team,添加自己的appid,然后选择自己的appid即可, 注意: 这里不需要开发者账号,自己的 apple id,就可以”:
- CMS .NET 程序框架 从2.0/3.5升级到4.0 版本后 需要调整的地方
问题一: document.forms1.action 不可使用 需要修改程 document.forms[0] .NET 程序框架 从2.0/3.5升级到4.0 版本后,document.forms ...
- 无法升级数据库....因为此版本的 SQL Server 不支持该数据库的非发布版本(539) 解决方案
使用SQL2012附加一个数据库时报出了以下错误:“无法升级数据库....因为此版本的 SQL Server 不支持该数据库的非发布版本(539).不能打开与此版本的 sqlserver.exe 不兼 ...
- Ubuntu 14.0 升级内核到指定版本
1.卸载现有内核sudo apt purge linux-headers-* linux-headers-*-generic linux-image-*-generic linux-image-ext ...
- MySQL升级-5.6升级到5.7版本&切换GTID模式
目前未在生产环境中升级过数据库版本,倒是在测试环境跟开发环境升级过. 可以通过mysqldump sql文件进行升级,也可以通过mysql_upgrade升级,前者耗时较长,且 ...
- 如何升级centos到最新版本
本文将教你如何升级centos到最新版本.centos中“update”命令可以一次性更新所有软件到最新版本.注意:不推荐使用update的y选项,-y选项会让你在安装每项更新前都进行确认(译者注:这 ...
- centos7 docker升级到最新稳定版本
原文:centos7 docker升级到最新稳定版本 一.前言 docker的版本分为社区版docker-ce和企业版dokcer-ee社,区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外 ...
- 升级ambari、HDP版本(ambari 2.1升级到2.4、HDP2.3升级到2.5)
转载自:http://blog.csdn.net/levy_cui/article/details/52461377 官方升级版本说明 http://docs.hortonworks.com/HDPD ...
随机推荐
- EPL II 编程打印
一.EPL II 格式及打印测试 注意N命令前的换行和最后P1后的换行.将此段代码复制到windows记事本里另存为Print.ext,文件名随便,后缀为ext.然后通过cmd控制命令行输入" ...
- C# 8.0 的新特性( NET Framework 4.8 与 Visual Studio 2019 )
C#8.0 于 2019年4月 随 .NET Framework 4.8 与 Visual Studio 2019 一同发布 使用VS2019体检C#8.0新功能: 编辑.csproj文件,添加如下代 ...
- Dubbo源码分析(4):Protocol
Protocol接口是Dubbo框架的核心组件.Dubbo框架启动protocol接口实现类,由spring的xml文件配置决定.RegistryProtocol协议是Protocol协议的核心,它负 ...
- 拉格朗日插值matlab实现
已给sin0.32=0.314567,sin0.34=0.333487,sin0.36=0.352274,用线性插值及抛物插值计算sin0.3367的值并估计截断误差. 1. 线性插值 clc;cle ...
- python 使用 jt400.jar
jt400helper.py #coding=utf-8 import jpype import os class JT400Helper(object): def __init__(self, se ...
- Distributed PostgreSQL on a Google Spanner Architecture – Storage Layer
转自:https://blog.yugabyte.com/distributed-postgresql-on-a-google-spanner-architecture-storage-layer/ ...
- SqrtTree学习笔记
散步的时候yy区间最值的不同分块做法,发现单点修改\(O(\sqrt{n})\)查询\(O(1)\)的做法不是很会? 于是yy了一个奇怪做法,写出来看看. 考虑查询的时候两端的散点可以用前后缀最值查出 ...
- mysql group by order by havaing where 顺序
结论: select xx from xx where xx group by xx order by xxx; select xx from xx group by xx having xx ord ...
- Go程序员面试算法宝典-读后感1
这本书是讲解Go语言程序员面试笔试真题的书籍,讲的还不错,值得一看. 计算机技术博大精深,日新月异………………大神们疯狂的更新着技术,(我就更新,不服打我呀)虽然换汤不换药,又有几个人能精通基础,再延 ...
- 下载 Java
官网:https://www.java.com 官网可以下载到最新版本,如果需要下载旧版本的,可以访问: http://www.oracle.com/technetwork/java/archive- ...