0

我必须对存储在 Firebase 中的数据进行全文搜索。由于firebase 不支持全文搜索,我正在Algolia Instantsearch-android 的帮助下。我正在使用 Glide 库在应用程序中显示图像。我在编译期间没有收到任何错误,但在单击搜索选项后出现以下错误。

java.lang.NoSuchMethodError: No virtual method into(Landroid/widget/ImageView;)Lcom/bumptech/glide/request/target/Target; in class Lcom/bumptech/glide/RequestBuilder; or its super classes (declaration of 'com.bumptech.glide.RequestBuilder' appears in /data/app/com.realtimesig.android.edjio-1/split_lib_dependencies_apk.apk)
                                                                                 at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:512)
                                                                                 at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:409)
                                                                                 at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6508)
                                                                                 at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6541)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5484)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5750)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
                                                                                 at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
                                                                                 at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
                                                                                 at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
                                                                                 at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
                                                                                 at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
                                                                                 at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3135)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
                                                                                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
                                                                                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                                 at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
                                                                                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
                                                                                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                                 at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)
                                                                                 at android.view.View.measure(View.java:19857)
                                                                                 at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275)
                                                                                 at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)
                                                                                 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)
                                                                                 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
                                                                                 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
                                                                                 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
                                                                                 at android.view.Choreographer.doCallbacks(Choreographer.java:686)
                                                                                 at android.view.Choreographer.doFrame(Choreographer.java:621)
                                                                                 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
02-15 22:50:39.145 3114-3114/com.realtimesig.android.edjio E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:751)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                 at android.os.Looper.loop(Looper.java:154)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

我检查了多个类似的问题和帖子,但无法解决问题。根据这些帖子,问题主要是由于我的应用程序和 Algolia Instantsearch-android 使用的 Glide 版本不匹配。尝试更改 Glide 和 Instantsearch-android 版本但没有任何成功。

build.gradle 依赖项

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
// For search functionality
implementation "com.algolia:instantsearch-android:1.4.2"

implementation 'com.firebaseui:firebase-ui-storage:3.2.1'
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.firebaseui:firebase-ui-auth:3.2.1'
implementation 'com.google.android.gms:play-services-auth:11.8.0'

// Required only if Twitter login support is required
compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
4

1 回答 1

1

对于那些面临同样问题的人——

最后找到兼容的版本如下:

FirebaseUI 3.1.2 和 instantsearch-android 1.4.2 -- 两者都使用 Glide 版本 4.3.1

使用这些错误被删除

于 2018-02-17T17:12:55.230 回答