Classes missing issue with Glide library

i try to build a extension using glide library, i created a function loadimage extension successfully builded, but when i load image app getting crush and i got erro log.

java.lang.NoClassDefFoundError: Failed resolution
of: Lcom/bumptech/glide/R$id;
at
com.bumptech.glide.request.target. ViewTarget.<clini
t>(Unknown Source:0)
at
com.bumptech.glide.request.target.lmageViewTarge
tFactory.buildTarget(Unknown Source:22)
at
com.bumptech.glide.GlideContext.buildImageViewTa
rget(Unknown Source:2)
at
com.bumptech.glide.RequestBuilder.into(Unknown
Source:72)
at
com.bibek.photoviewtools.repack.b.run(Unknown
Source:16)
at
android.os.Handler.handleCallback(Handler.java:958)
at
android.os.Handler.dispatchMessage(Handler.java:9
9)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)
at
android.app.ActivityThread.main(ActivityThread.java:
8762)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.Runtimelnit$MethodAndArg
sCaller.run(Runtimelnit.java:561)
at
com.android.internal.os.Zygotelnit.main(Zygotelnit.ja
va:1013)
Caused by: java.lang.ClassNotFoundException:
com.bumptech.glide.R$id
... 13 more

my project details:

# Add any ProGuard configurations specific to this extension here.

-keep public class com.bibek.photoviewtools.PhotoViewTools {
    public *;
}

-keeppackagenames gnu.kawa**, gnu.expr**

-optimizationpasses 4
-allowaccessmodification
-mergeinterfacesaggressively

-repackageclasses 'com/bibek/photoviewtools/repack'
-flattenpackagehierarchy
-dontpreverify

# Glide specific rules
-keep public class com.bumptech.glide.** { *; }
-keep public interface com.bumptech.glide.** { *; }
-dontwarn com.bumptech.glide.**
-dontwarn com.bumptech.glide.load.resource.gif.**
-dontwarn com.bumptech.glide.load.resource.bitmap.**
-dontwarn com.bumptech.glide.load.engine.cache.**
-dontwarn androidx.exifinterface.media.**
-dontwarn android.support.v4.view.**

# PhotoView specific rules
-keep class com.github.chrisbanes.photoview.** { *; }
-dontwarn com.github.chrisbanes.photoview.**

# General ProGuard settings
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault

-dontwarn java.lang.invoke.LambdaMetafactory
-keep class java.lang.invoke.LambdaMetafactory { *; }

can anyone help me for solve the issue, i’m beginner on this fild. :pray: :slightly_smiling_face:

2 Likes

Mentioned class is missing. Make sure that the class is available into your project.

how to solve the error

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/R$id;

Test after building apk

now complie succesfully after building apk when call the function the got this error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/R$id;

  1. Use Glide v4.
  2. From where did you get aar/jar file?

maven repository: https://mvnrepository.com/artifact/com.github.bumptech.glide/glide/4.14.2

image

now my yml look like this:

You still need gifdecoder jar.

Create com > bumptech > glide subfolders in src folder.
Add R.java file.

package com.bumptech.glide;

public class R {
    public static class id{
        public static int glide_custom_view_target_tag = 2131427340;
    }
}
2 Likes

it’s random number?

Try and find out.

1 Like