bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.63k stars 6.12k forks source link

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

Closed lgl88911 closed 4 years ago

lgl88911 commented 4 years ago

I build the master source and create glide-full-4.11.0-SNAPSHOT.jar, git clone the master code and use below cmd to build with Android SDK API 29(Android Q):

./gradlew jar

Using the glide-full-4.11.0-SNAPSHOT.jar on the Android Q for My Apk, the Apk build in AOSP by Android.mk, I add flow content to Android.mk:

LOCAL_STATIC_JAVA_LIBRARIES := glide_music
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := glide_music:app/libs/glide-full-4.11.0-SNAPSHOT.jar

My apk can link glide success, but start run the app will crash and show :

11-25 11:42:08.919  4681  4681 W Glide   : Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
11-25 11:42:08.940  4681  4681 D AndroidRuntime: Shutting down VM
--------- beginning of crash
11-25 11:42:08.944  4681  4681 E AndroidRuntime: FATAL EXCEPTION: main
11-25 11:42:08.944  4681  4681 E AndroidRuntime: Process: com.novatek.musicplayer, PID: 4681
11-25 11:42:08.944  4681  4681 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/R$id;
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at com.bumptech.glide.request.target.ViewTarget.<clinit>(ViewTarget.java:52)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at com.bumptech.glide.request.target.ImageViewTargetFactory.buildTarget(ImageViewTargetFactory.java:20)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at com.bumptech.glide.GlideContext.buildImageViewTarget(GlideContext.java:99)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at com.bumptech.glide.RequestBuilder.into(RequestBuilder.java:701)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at com.novatek.musicplayer.ui.LibraryRearrangeableListAdapter.onBindViewHolder(LibraryRearrangeableListAdapter.java:111)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7031)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7073)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5990)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6257)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6096)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6092)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:561)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4115)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3832)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4385)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1236)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
11-25 11:42:08.944  4681  4681 E AndroidRuntime:        at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at com.android.internal.policy.DecorView.onLayout(DecorView.java:779)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.View.layout(View.java:21927)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.ViewGroup.layout(ViewGroup.java:6260)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3080)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2590)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.Choreographer.doCallbacks(Choreographer.java:790)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.Choreographer.doFrame(Choreographer.java:725)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:883)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:100)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7356)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
11-25 11:42:08.945  4681  4681 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

unzip the glide-full-4.11.0-SNAPSHOT.jar, can't find "com/bumptech/glide/R"

stale[bot] commented 4 years ago

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.

Lalalatte commented 4 years ago

@lgl88911 hi Frank ,It seems like you're not adding the res in glide, which can be found in glide.aar image

I'm not sure where it is in project AOSP. But you can try downloading it from Maven since It should have no impact on the project.

hyy920109 commented 1 year ago

so this question resolved?

xintanggithub commented 7 months ago

I also encountered the same problem

lgl88911 commented 7 months ago

Apologies for the very late feedback, replacing jar with glide-4.10.0.aar solved the issue 4 years ago

Bivek9620 commented 3 months ago

hello, i got java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bumptech/glide/R$id; this error on glide-4.14.2.jar how to fix the error, i want to fix with jar not aar.