Java Can';t在Android中下载图像
在Asynctask的onPostExecute方法中Java Can';t在Android中下载图像,java,android,android-glide,Java,Android,Android Glide,在Asynctask的onPostExecute方法中 LinearLayout ll=(LinearLayout) findViewById(R.id.mylinlay); TextView tv=new TextView(Download_İmage.this); tv.setText("try"); ImageView tempimg=new ImageView(Download_İmage.this); Glide.with(getApplicationContext()).load("
LinearLayout ll=(LinearLayout) findViewById(R.id.mylinlay);
TextView tv=new TextView(Download_İmage.this);
tv.setText("try");
ImageView tempimg=new ImageView(Download_İmage.this);
Glide.with(getApplicationContext()).load("http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg").into(tempimg);
tv.setCompoundDrawables(tempimg.getDrawable(),null,null,null);
ll.addView(tv);
这里将所有文本视图动态添加到linearlayout。所有文本视图看起来都正常,并且尝试使用现有的可绘制图像。但当我尝试通过毕加索或glide下载图像时,它不工作。因此我无法获取远程图像
com.bumptech.glide.glide未能通过锁验证,将运行较慢。
有这条消息和同样的毕加索消息。我用调试选项检查了,但是图像可绘制为空。你应该像这样使用glide
Glide.with(mContext)
.load("someurl")
.placeholder("your_placeHolder")
.fitCenter()
.error("your_errorImg")
.into(imageView);
在快速的谷歌搜索之后,唯一显示相同问题的结果是Glide的GitHub上的这个 显然,这一错误存在于Glide的旧版本中,但已在2017年修复。您应将Glide版本更新至最新版本(目前为4.6.1): 在项目的
build.gradle
文件中:
repositories {
mavenCentral()
google()
}
您使用的Glide版本是什么?首先将您的“ImageView”添加到linearlayout,然后尝试使用Glide或Picassocomile加载“com.github.bumptech.Glide:Glide:3.5.2”尝试此操作并编译“com.firebaseui:firebaseui存储:0.6.0”,但先生,我必须通过setCompoundDrawablesSir将ImageView添加到我的文本视图中。我添加了以下错误:无法更改配置的依赖项“:app:\u debugAnnotationProcessor”在解析后。顺便说一句,我的gradle联机而不是脱机。结果相同,先生。不管怎样
repositories {
mavenCentral()
google()
}