GithubHelp home page GithubHelp logo

algolia / instantsearch-android Goto Github PK

View Code? Open in Web Editor NEW
155.0 76.0 28.0 97.48 MB

A library of widgets and helpers to build instant-search applications on Android.

Home Page: https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/android/

License: Apache License 2.0

Kotlin 100.00%
android android-library algolia search instant-search widgets custom-widgets interface-builder open-source search-interface

instantsearch-android's Introduction

InstantSearch Android

Download Build Status

InstantSearch family: InstantSearch Android | InstantSearch iOS | React InstantSearch | InstantSearch.js | Angular InstantSearch | Vue InstantSearch.

InstantSearch Android is a library providing widgets and helpers to help you build the best instant-search experience on Android with Algolia. It is built on top of Algolia's Kotlin API Client to provide you a high-level solution to quickly build various search interfaces.

Examples

You can see InstantSearch Android in action in our examples app, have a look at it to see concrete examples of all the available widgets.

Usage

Installing InstantSearch Android

You can add InstantSearch to your Android application by adding the following line to your build.gradle's dependencies:

implementation "com.algolia:instantsearch-android:$instantsearch_version"

ℹ️ Please follow the migration guide to migrate from 2.x to the latest version.
▶️ See the documentation. You can start with the Getting Started Guide.

Compose

You can add Compose UI support by adding the following line to your build.gradle's dependencies:

implementation "com.algolia:instantsearch-compose:$instantsearch_version"
Paging 3

You can add Paging 3 support by adding the following line to your build.gradle's dependencies:

implementation "com.algolia:instantsearch-android-paging3:$instantsearch_version"
Insights

You can add InstantSearch Insights to your Android application by adding the following line to your build.gradle's dependencies.

implementation "com.algolia:instantsearch-insights-android:$instantsearch_version"

Please refer to the library for more details.

Requirements

  • Kotlin 1.6+
  • Android SDK 21+
  • Java 8+

R8 / Proguard rules

If you use this library in an Android project which uses R8, there is nothing you have to do. The specific rules are already bundled into the JAR, which can be interpreted by R8 automatically.

If however, you don’t use R8, then you might need rules from Algolia Kotlin Client which is a dependency of this library.

Telemetry

InstantSearch Android collects data points at runtime. This helps the InstantSearch team improve and prioritize future development.

Here's an exhaustive list of the collected data:

  • InstantSearch version
  • The name of the instantiated InstantSearch components, for example, HitsSearcher, FilterState
  • The name of the components with custom parameters (overridden defaults). InstantSearch doesn't collect the values of those parameters. For example, the default of the facets value in FacetListInteractor is an empty list. If you instantiate it with a list of facets, then the telemetry tracks that the facets parameter received a custom value, but not the value itself.

InstantSearch doesn't collect any sensitive or personal data. However, you can still opt out of the telemetry collection with the following code:

Telemetry.shared.enabled = false

Contributing

From reporting bugs or missing functionality to fixing a typo or proposing an improvement, all contributions are welcome! Read the Contributing Guide to setup your development environment.

Troubleshooting

Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the library.

License

InstantSearch Android is licensed under Apache V2.

instantsearch-android's People

Contributors

aallam avatar amv-bamboo avatar omaralisaid avatar plnech avatar q-litzler avatar renovate[bot] avatar robertmogos avatar sarahdayan avatar spinach avatar tbra91 avatar vladislavfitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instantsearch-android's Issues

Update favicon

Currently we have two favicons, either react logo (most pages) or Algobot's eye (/javadoc):

image

Maybe we can use Seb's awesome logo? (left side of this)

Cannot find the setter for attribute 'algolia:attribute' with parameter type java.lang.String on android.widget.ImageView.

I know this this issue has been solved in the previous version of Algolia instantsearch, I can run this example without error. But when I tried to combine this example (add this to google firestore fireeats example project), this error reappear. First it happen on TextView, but i solved it by creating custom view with no error. After I updated fireeats dependencies to the latest version (due to email auth error), I have similar error on ImageView. Can I create custom ImageView or maybe there is information about conflicted (version of) dependencies between Firestore fireeats example project with Algolia instantsearch example project?
Thank You,

On click on item

I' quite new on android/algolia and I dont get the way to make the onclik on item ( using firebase as database ) and send it to its activity.

Unregister Result and Error listeners

Hello! I'am need in unregister Result and Error listeners functions.
In my custom Searcher i'am do it
public Searcher unregisterResultListener(@NonNull AlgoliaResultsListener resultListener) { if (resultListeners.contains(resultListener)) { resultListeners.remove(resultListener); } return this; }

and

public Searcher unregisterErrorListener(@NonNull AlgoliaErrorListener errorListener) { if (errorListeners.contains(errorListener)) { errorListeners.remove(errorListener); } return this; }

Thanks!

Error using instantsearch-android-1.4.1

Hi,
I got this gradle build error log when using instantsearch-android-1.4.1
compile 'com.algolia:instantsearch-android:1.+' on build.gradle
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.fireeats"
minSdkVersion 16
targetSdkVersion 27

But its build normally when I change to : compile 'com.algolia:instantsearch-android:1.4.0'

14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not resolve all files for configuration ':app:debugCompileClasspath'.
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not find instantsearch-android.jar (com.algolia:instantsearch-android:1.4.1).
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Searched in the following locations:
14:58:56.549 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] https://jcenter.bintray.com/com/algolia/instantsearch-android/1.4.1/instantsearch-android-1.4.1.jar

Thank You

Widgets | SearchBox anchor does not work

The link to SearchBox on the left bar seems broken:
link

Weirdly the id is searchbox and it seems the link is valid, but either clicking on it or manually typing the anchor in the url does not work. If we reopen the url and press enter, the page loads on the SearchBox, but that's only after a page reload. @LukyVj any idea what could cause this?

Change API Key in realtime

Hello! I need change API Key in realtime, but it impossible.
This need if user be very intensive use search or if key leak, i'am banned this user, and need change secure key for all users in realtime.

Over-concatenated user agents

I got user agents that look like algolia_for_android_(3.10.1);_android_(4.4.4);_instant_search_android_(0.5.1);_instant_search_android_(0.5.1);_instant_search_android_(0.5.1);_instant_search_android_(0.5.1);_instant_search_android_(0.......

Are we kind of appending it again and again?

Wrong facet value count returned

Hi,
we have the same issue for iOS : algolia/instantsearch-ios#27
actually, in our product list, we have a "brand" facet so in the SearchResult we have a nice list of 100 brands (the most popular).
If we apply a facet refinement with one or more of those brands, the SearchResult returns the filtered products with the brands facet values and their counts.
But if we apply a facet refinement with one or more brands that was not initially in the list of 100 (we can search brands), the SearchResult returns for those brands facet values a count equal to 0.
Everything works fine in the Algolia Dashboard, but not with the iOS & Android SDK.
Maybe we did something wrong, or maybe it is a bug in the SDK.
Thank you for your reply,

NullPointerException in BindingViewHelper.java line 181

I am using instant search on 2 different screens. Both screens point to the same index but have different facet refinement values and different layout files for the hits item layout. Instant search is working on the home screen which is a fragment but it's crashing on the other screen which is an activity. If I comment out/remove the home screen code, then the 2nd starts working again. I have attached the log below


java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getId()' on a null object reference
        at com.algolia.instantsearch.ui.databinding.BindingHelper.getFullAttribute(BindingHelper.java:181)
        at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:473)
        at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:409)
        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6673)
        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6714)
        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5647)
        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5913)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
        at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1559)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
        at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3529)
        at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1737)
        at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4928)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
        at android.view.Choreographer.doCallbacks(Choreographer.java:723)
        at android.view.Choreographer.doFrame(Choreographer.java:655)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Please let me know if you need more details.

NoClassDefFoundError

Bug: What is the current behavior?
When building my application, the build fails with this error message:

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/databinding/DataBinderMapper;
at android.databinding.DataBindingUtil.(DataBindingUtil.java:31)

Cannot find the setter for attribute 'algolia:attribute' with parameter type java.lang.String on android.widget.TextView

Hello!

After updating to Android Studio 3.0 and to Android Gradle Plugin 3.0, I've encountered the following compile time error: Error:(48, 38) Cannot find the setter for attribute 'algolia:attribute' with parameter type java.lang.String on android.widget.TextView.

Here is my layout where I'm using this attribute:

            <TextView
                android:id="@+id/book_name"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:fontFamily="sans-serif-condensed"
                android:padding="6dp"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.AppCompat.Caption"
                android:textSize="20sp"
                android:typeface="normal"
                android:scrollHorizontally="false"
                android:maxLines="5"
                algolia:attribute='@{"name"}'
                android:layout_marginStart="8dp"
                app:layout_constraintLeft_toRightOf="@+id/cover"
                android:layout_marginLeft="8dp"
                android:layout_marginEnd="16dp"
                app:layout_constraintRight_toRightOf="parent"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                android:layout_marginBottom="16dp"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintVertical_bias="0.0" />

Error is raised on 0.8.0 version of instantsearch, as well as on 1.1.2.

Looks like it's a problem in BindingHelper class where you set @BindingAdapter("attribute"). As in docs, now you need to set "bind:attribute" instead of just "attribute", i.e. you need to set XML namespace here, and "bind" namespace is for custom namespaces.

NullPointerException in HitsAdapter.ViewHolder when there are no data bindings in item layout used.

For my Hits widget, I have an item layout where I have used only custom views and no data bindings. This results in an NPE when HitsAdapter.ViewHolder is being initialised. I did some debugging and found that the crash happens when it attempts to iterate through a map of bindings which is null since I have no bindings in my layout file.

I am able to stop the crash by adding a data binding to at least one view in my item layout file.

java.lang.NullPointerException at com.algolia.instantsearch.ui.views.Hits$HitsAdapter$ViewHolder.<init>(Hits.java:580) at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onCreateViewHolder(Hits.java:448) at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onCreateViewHolder(Hits.java:410) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5869) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1559) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)

I am using version 1.8.4 of instantsearch-android

Old glide library 3.8.0 -> 4.3.1

You're using glide 3.8.0, however glide 4.3.1 is available. It's not possible to import the newest version of the library(because of the error) for other needs. The only way is to use old vesion, sometimes it's very sad.

Artifact names could get rid of redundant "android" part

Currently the main artifact is named com.algolia:instantsearch-android, #102 introduces core released as com.algolia:instantsearch-android-core.

To avoid redundancy, let's simplify those to com.algolia:instantsearch and com.algolia:instantsearch-core.

Being a breaking change, this should:

  • Be done with proper change management (making sure that all users hear the news, and that new users of former name would clearly see it's deprecated)
  • Wait until V2

Only one layout element

Bug: What is the current behavior?
When building my application, the build fails with this error message:

Error:Only one layout element and one data element are allowed. /path/to/your/app/build/intermediates/res/merged/debug/layout/hits_item.xml has 2

No resource type specified

Bug: What is the current behavior?
When building my application, the build fails with this error message:
Error:(42, 42) **No resource type specified** (at 'attribute' with value '@{"image"}’).

Too much work on main thread when using Custom Hit Views

I get the following warning (and noticeable screen stuttering) when using a Custom Hit views.

Skipped 51 frames! The application may be doing too much work on its main thread.

The entire layout has one ImageView and three TextViews. For the text views, I have followed the example in TimestampHitView, because I need some simple formatting before I set the text.

Note: If I directly use algolia:attribute I don't have this issue, but then I can't format my text.

Any ideas on what I might be doing wrong?

FYI: I am using a real device, not an emulator.

NoClassDefFoundError when running a search using a Hits view

I'm trying to integrate the code from your Android tutorial into my app. When running helper.search(), the app crashes, failing to find a class def for "com.android.databinding.library.baseAdapters.DataBinderMapperImpl".

My app uses Kotlin and AndroidX, if it makes any difference.

Do you want to request a feature or report a bug?
Bug

Bug: What is the current behavior?
Activity crashes with stack trace

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/android/databinding/library/baseAdapters/DataBinderMapperImpl;
        at com.algolia.instantsearch.DataBinderMapperImpl.collectDependencies(DataBinderMapperImpl.java:71)
        at androidx.databinding.MergedDataBinderMapper.addMapper(MergedDataBinderMapper.java:58)
        at androidx.databinding.MergedDataBinderMapper.addMapper(MergedDataBinderMapper.java:60)
        at androidx.databinding.DataBinderMapperImpl.<init>(DataBinderMapperImpl.java:5)
        at androidx.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:32)
        at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
        at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onCreateViewHolder(Hits.java:459)
        at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onCreateViewHolder(Hits.java:424)
        at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
        at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
        at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
        at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
        at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
        at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1858)
        at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5044)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1004)
        at android.view.Choreographer.doCallbacks(Choreographer.java:816)
        at android.view.Choreographer.doFrame(Choreographer.java:748)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:990)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6863)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.databinding.library.baseAdapters.DataBinderMapperImpl" on path

Bug: What is the expected behavior?
Hits view loads with search results

Integrate Javadoc

Currently the API Reference looks like this:

image

I don't think it is worth restyling the javadoc, however do you think we can have the same header as on the other pages, to improve consistency?

Add three strip menu button to show Navigation Drawer on SearchBox widget

Feature: What is your use case for such a feature?
Could You add a menu like button (three strips icon) to searchbox widget that I could use to show navigationdrawer, just like the one used by android google play app? That would be great, to eliminate the toolbar and give more room tho show the search results.
Thank You.

NoClassDefFoundError jayway/jsonpath/Predicate

see originally algolia/instantsearch#2895 by @martipello


just started getting this error this morning using the most recent version

java.lang.NoClassDefFoundError: Failed resolution of: 
[Lcom/jayway/jsonpath/Predicate;     
at com.algolia.instantsearch.utils.JSONUtils.getObjectFromJSONPath(JSONUtils.java:40)
at com.algolia.instantsearch.utils.JSONUtils.getStringFromJSONPath(JSONUtils.java:22)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:473)
at com.algolia.instantsearch.ui.views.Hits$HitsAdapter.onBindViewHolder(Hits.java:409)

Unregister SearchView from InstantSearch

Hello!

API have method registerSearchView(@nonnull final Activity activity, @nonnull final android.support.v7.widget.SearchView searchView) and similars at InstantSearch.

But, I need in method unregisterSearchView (for reuse SearchView with another a InstantSearch).

Please add, thanks!

Suffix databinding

Hello,

I'd like to report a minor error in BindingHelper.java

     * Gets the full version of an attribute, with its eventual prefix and suffix.
     *
     * @param view         the view mapped to this attribute.
     * @param rawAttribute the raw value of the attribute.
     * @return the attribute value, prefixed and suffixed if any was specified on the view.
     */
    public static String getFullAttribute(View view, String rawAttribute) {
        String attribute = "";
        final int id = view.getId();
        final String prefix = prefixes.get(id);
        final String suffix = suffixes.get(id);
        if (prefix != null) {
            attribute = prefix;
        }
        attribute += rawAttribute;
        if (suffix != null) {
            attribute = prefix;
        }
        return attribute;
    }

The suffix here is never added unfortunately nor the rawAttribute when the suffix is not null.

Here's an exemple

image

Error inflating class com.algolia.instantsearch.ui.views.Hits

Do you want to request a feature or report a bug? Bug

Bug: What is the current behavior?

I tried to use the instantearch Android library. Followed all the steps in this guide, but ended with an error.

android.view.InflateException: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits

FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo: android.view.InflateException: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.view.InflateException: Binary XML file line #47: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits
     Caused by: android.view.InflateException: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at android.view.LayoutInflater.createView(LayoutInflater.java:647)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at com.rsg.SciSearch.MainActivity.onCreate(MainActivity.kt:30)
        at android.app.Activity.performCreate(Activity.java:7009)
        at android.app.Activity.performCreate(Activity.java:7000)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalStateException: Your View for attribute null must have an android:id.
        at com.algolia.instantsearch.ui.databinding.BindingHelper.mapAttribute(BindingHelper.java:166)
        at com.algolia.instantsearch.ui.databinding.BindingHelper.setVariantForView(BindingHelper.java:127)
        at com.algolia.instantsearch.ui.databinding.BindingHelper.setVariantForView(BindingHelper.java:100)
        at com.algolia.instantsearch.ui.views.Hits.<init>(Hits.java:142)
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.rsg.SciSearch.MainActivity.onCreate(MainActivity.kt:30) 
        at android.app.Activity.performCreate(Activity.java:7009) 
        at android.app.Activity.performCreate(Activity.java:7000) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
08-07 20:18:01.950 9885-9885/com.rsg.SciSearch E/CrashlyticsCore: Failed to execute task.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:algolia="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/activity_main"
    android:orientation="vertical">
        <com.algolia.instantsearch.ui.views.Hits
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            algolia:itemLayout="@layout/hits_item"/>
    </LinearLayout>

Note that there are comments above the LinearLayout in my actual code (in activity_main) so the line 47 displayed in the error is:

<com.algolia.instantsearch.ui.views.Hits

hits_item.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:algolia="http://schemas.android.com/apk/res-auto">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/product_image"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:scaleType="fitCenter"
            algolia:attribute='@{"image"}'/>

        <TextView
            android:id="@+id/product_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            algolia:attribute='@{"name"}'/>

        <TextView
            android:id="@+id/product_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            algolia:attribute='@{"salePrice"}'/>
    </LinearLayout>
</layout>

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private val ALGOLIA_APP_ID = "latency"
    private val ALGOLIA_SEARCH_API_KEY = "3d9875e51fbd20c7754e65422f7ce5e1"
    private val ALGOLIA_INDEX_NAME = "bestbuy"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val searcher = Searcher.create(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME)
        val helper = InstantSearch(this, searcher)
        helper.search()
    }
}

Please help me resolve this issue.

Proguard config

After enabling the Proguard in my project, I see a lot of errors caused by your library. So, I think you should update your config according to this tips:

Eventbus

In my project, I don't use Eventbus at all, but I should write it's Proguard rules. It's kinda strange.

Here are its rules:

-keepattributes *Annotation*
-keepclassmembers class ** {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

# Only required if you use AsyncExecutor
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}

Jsonpath

Reasons are the same, here is the config:

-dontwarn com.jayway.jsonpath.spi.json.GsonJsonProvider
-dontwarn com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider
-dontwarn com.jayway.jsonpath.spi.json.JacksonJsonProvider
-dontwarn com.jayway.jsonpath.spi.json.TapestryJsdonProvider
-dontwarn com.jayway.jsonpath.spi.json.JsonOrgJsonProvider
-dontwarn com.jayway.jsonpath.spi.json.TapestryJsonProvider
-dontwarn com.jayway.jsonpath.spi.mapper.GsonMappingProvider*
-dontwarn com.jayway.jsonpath.spi.mapper.JacksonMappingProvider
-dontwarn com.jayway.jsonpath.spi.mapper.JsonOrgMappingProvider

# Necessary for ignoring json-smart's logging dependencies
-dontwarn org.slf4j.*

I can submit PR with edited proguard-rules.pro file later, if you agree with this.

Upgrade Glide 4.3.1 -> 4.7.1

Currently the Hits.java class depends on an old version of the Glide library. This is inhibiting developers to upgrade to the latest version of Glide.

There have been some breaking changes/new features in the Glide library and it would be nice to be able to use the latest. Thanks :)

Related issues #49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.