Kotlin
Glide Version:
4.4.0
Device/Android Version:
minSdkVersion 21
Issue details / Repro steps / Use case background:
var target = object : SimpleTarget<ByteArray>(800, 800) {
override fun onResourceReady(resource: ByteArray?, transition: Transition<in ByteArray>?) {
}
}
Glide.with(this).load(mFile).into(target)
Can not build project, because 'into()' has error.
Java known target is what, Kolin didn't known.
Error:(221, 46) None of the following functions can be called with the arguments supplied:
public open fun <Y : Target<Drawable!>!> into(@NonNull p0: ???): (???..???) defined in com.bumptech.glide.RequestBuilder
public open fun into(p0: ImageView!): ViewTarget<ImageView!, Drawable!>! defined in com.bumptech.glide.RequestBuilder
Glide.with(this).load(mFile) returns a RequestBuilder<Drawable>. In turn, RequestBuilder<Drawable> requires a Target<Drawable>, but you're providing a Target<ByteArray>.
Either use Glide.with(this).as(ByteArray.class) or provide a Target<Drawable>. I'm not totally sure what ByteArray is, but if it's equivalent to the Java byte[] then it should work.
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.
Most helpful comment
Glide.with(this).load(mFile)returns aRequestBuilder<Drawable>. In turn,RequestBuilder<Drawable>requires aTarget<Drawable>, but you're providing aTarget<ByteArray>.Either use
Glide.with(this).as(ByteArray.class)or provide aTarget<Drawable>. I'm not totally sure whatByteArrayis, but if it's equivalent to the Javabyte[]then it should work.