我在我的应用中使用Ion ImageLoader在应用中加载图像
第一个问题我真的不知道是什么造成了这个
java.lang.NoClassDefFoundError: com.koushikdutta.ion.IonRequestBuilder$6
at com.koushikdutta.ion.IonRequestBuilder.execute(IonRequestBuilder.java:610)
at com.koushikdutta.ion.BitmapFetcher.execute(BitmapFetcher.java:134)
at com.koushikdutta.ion.IonDrawable.draw(IonDrawable.java:494)
at android.widget.ImageView.onDraw(ImageView.java:858)
第二个问题是我试图获得Circle ImageView
java.lang.IllegalArgumentException: Cannot draw recycled bitmaps
at android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:789)
at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118)
at com.koushikdutta.ion.IonDrawable.draw(IonDrawable.java:673)
at android.widget.ImageView.onDraw(ImageView.java:990)
at android.view.View.draw(View.java:14313)
这是我用于Circle ImageView的代码
public class CircleTransform implements Transform {
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
/* int x = (source.getWidth() - size) / 2 */;
/* int y = (source.getHeight() - size) / 2 */;
int x = (source.getWidth() - size);
int y = (source.getHeight() - size);
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
if (squaredBitmap != source) {
source.recycle();
}
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
BitmapShader shader = new BitmapShader(squaredBitmap,
BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
paint.setShader(shader);
paint.setAntiAlias(true);
float r = size / 2f/* 2f */;
canvas.drawCircle(r, r, r, paint);
squaredBitmap.recycle();
return bitmap;
}
@Override
public String key() {
return "circle";
}
}
图书馆工作正常且易于使用,但我想解决这些崩溃问题 我使用的是最新版本的Ion