Reputation: 5845
I cannot figure out why I am getting the following error:
E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/somecompany/someapp/common/glide/GlideWrapper$loadCircularProfileImg$1$1; at com.somecompany.someapp.common.glide.GlideWrapper.loadCircularProfileImg(GlideWrapper.kt:31) at com.somecompany.someapp.main.MainActivity.showSideBarProfPhoto(MainActivity.kt:179) at com.somecompany.someapp.main.MainActivity.onCreate(MainActivity.kt:115) at android.app.Activity.performCreate(Activity.java:6955) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
with the code:
fun loadCircularProfileImg(ctx: Context, user: User?, targetImageView: ImageView) {
user?.let {
// With let getting a NoClassDefFoundError error 😱
GlideApp.with(ctx)
.asBitmap()
.load(FirebaseStorage.getInstance().reference.child(it.profImgUrl))
.into(object : BitmapImageViewTarget(targetImageView) {
override fun setResource(resource: Bitmap?) {
// Will add code here
}
})
}
}
but not with:
fun loadCircularProfileImg(ctx: Context, user: User?, targetImageView: ImageView) {
if (user != null) { // With this the code works
GlideApp.with(ctx)
.asBitmap()
.load(FirebaseStorage.getInstance().reference.child(user.profImgUrl))
.into(object : BitmapImageViewTarget(targetImageView) {
override fun setResource(resource: Bitmap?) {
// Will add code here
}
})
}
}
Upvotes: 3
Views: 417
Reputation:
when you call loadCircularProfileImg that time user class are define i am call same method and not getting any error like below...
loadCircularProfileImg(this,User(),imageview)
i am used above code and not getting any error.
Upvotes: 1