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 ...
随机推荐
- Mycat简单配置
最近项目中需要用到Mycat来作为Mysql的分表中间件.所以稍微研究了一下. Mycat使用起来是非常方便,而且最重要的是配置简单,稍显麻烦的就是需要对库中的每一个表都进行配置. 记录一下最重要的几 ...
- native与H5优缺点及H5测试
一.native(原生)与H5优缺点介绍 native(原生)优点 1.运行速度快 2.可以应用到底层的API 3.便捷性与易用性 4.打开会比较节省流量 native(原生)缺点 1.不同操作系统需 ...
- RCNN,Fast RCNN,Faster RCNN 的前生今世:(3) SPP - Net
SPP-Net是出自2015年发表在IEEE上的论文-<Spatial Pyramid Pooling in Deep ConvolutionalNetworks for Visual Reco ...
- jedis:分片集群使用
jedis使用 引入依赖 <dependency> <groupId>redis.clients</groupId> <artifactId>jedis ...
- windows下命令行切换目录
1.切换目录 C:\Users\MACHENIKE> cd H:/www C:\Users\MACHENIKE>H: H:\www> 2.查看目录文件 H:\www>dir
- IKVM
$ ikvmc -target:library E:\jt400.jar $ ikvmc -target:library -reference:E:\jt400.dll E:\FTU.jar ...
- C利用time函数实现简单的定时器
//定时器 #include <stdio.h> #include <time.h> #include <stdlib.h> int main(int num, c ...
- Bzoj 1010: [HNOI2008]玩具装箱toy(斜率优化)
1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec Memory Limit: 162 MB Description P教授要去看奥运,但是他舍不下他的玩具,于是他决定 ...
- noip考点整理(应该不是很完整……)
部分来自百度百科.其他的博客 一.必须会的 1.暴力: DFS.BFS.灌水法搜索.回溯搜索.记忆化搜索.启发式搜索.最优性剪枝.可行性剪枝 2.贪心 3.模拟 4.骗分 二.基础算法 1.图论:SP ...
- 【一起来烧脑】读懂Promise知识体系
知识体系 Promise基础语法,如何处理错误,简单介绍异步函数 内容 错误处理的两种方式: reject('错误信息').then(null, message => {}) throw new ...