{"action":"created","issue":{"url":"https://api.github.com/repos/algolia/instantsearch-android/issues/96","repository_url":"https://api.github.com/repos/algolia/instantsearch-android","labels_url":"https://api.github.com/repos/algolia/instantsearch-android/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/algolia/instantsearch-android/issues/96/comments","events_url":"https://api.github.com/repos/algolia/instantsearch-android/issues/96/events","html_url":"https://github.com/algolia/instantsearch-android/issues/96","id":348475502,"node_id":"MDU6SXNzdWUzNDg0NzU1MDI=","number":96,"title":"Error inflating class com.algolia.instantsearch.ui.views.Hits","user":{"login":"radi-cho","id":12954909,"node_id":"MDQ6VXNlcjEyOTU0OTA5","avatar_url":"https://avatars3.githubusercontent.com/u/12954909?v=4","gravatar_id":"","url":"https://api.github.com/users/radi-cho","html_url":"https://github.com/radi-cho","followers_url":"https://api.github.com/users/radi-cho/followers","following_url":"https://api.github.com/users/radi-cho/following{/other_user}","gists_url":"https://api.github.com/users/radi-cho/gists{/gist_id}","starred_url":"https://api.github.com/users/radi-cho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radi-cho/subscriptions","organizations_url":"https://api.github.com/users/radi-cho/orgs","repos_url":"https://api.github.com/users/radi-cho/repos","events_url":"https://api.github.com/users/radi-cho/events{/privacy}","received_events_url":"https://api.github.com/users/radi-cho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-07T20:29:47Z","updated_at":"2018-08-08T07:08:41Z","closed_at":null,"author_association":"NONE","body":"**Do you want to request a *feature* or report a *bug*?** Bug\r\n\r\n**Bug: What is the current behavior?**\r\n\r\nI tried to use the instantearch Android library. Followed all the steps in [this guide](https://community.algolia.com/instantsearch-android/getting-started.html), but ended with an error.\r\n> android.view.InflateException: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits\r\n\r\n```\r\nFATAL EXCEPTION: main\r\n    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\r\n        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)\r\n        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)\r\n        at android.app.ActivityThread.-wrap11(Unknown Source:0)\r\n        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)\r\n        at android.os.Handler.dispatchMessage(Handler.java:106)\r\n        at android.os.Looper.loop(Looper.java:164)\r\n        at android.app.ActivityThread.main(ActivityThread.java:6494)\r\n        at java.lang.reflect.Method.invoke(Native Method)\r\n        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)\r\n        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)\r\n     Caused by: android.view.InflateException: Binary XML file line #47: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits\r\n     Caused by: android.view.InflateException: Binary XML file line #47: Error inflating class com.algolia.instantsearch.ui.views.Hits\r\n     Caused by: java.lang.reflect.InvocationTargetException\r\n        at java.lang.reflect.Constructor.newInstance0(Native Method)\r\n        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)\r\n        at android.view.LayoutInflater.createView(LayoutInflater.java:647)\r\n        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)\r\n        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)\r\n        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)\r\n        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)\r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)\r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)\r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)\r\n        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)\r\n        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)\r\n        at com.rsg.SciSearch.MainActivity.onCreate(MainActivity.kt:30)\r\n        at android.app.Activity.performCreate(Activity.java:7009)\r\n        at android.app.Activity.performCreate(Activity.java:7000)\r\n        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)\r\n        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)\r\n        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)\r\n        at android.app.ActivityThread.-wrap11(Unknown Source:0)\r\n        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)\r\n        at android.os.Handler.dispatchMessage(Handler.java:106)\r\n        at android.os.Looper.loop(Looper.java:164)\r\n        at android.app.ActivityThread.main(ActivityThread.java:6494)\r\n        at java.lang.reflect.Method.invoke(Native Method)\r\n        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)\r\n        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)\r\n     Caused by: java.lang.IllegalStateException: Your View for attribute null must have an android:id.\r\n        at com.algolia.instantsearch.ui.databinding.BindingHelper.mapAttribute(BindingHelper.java:166)\r\n        at com.algolia.instantsearch.ui.databinding.BindingHelper.setVariantForView(BindingHelper.java:127)\r\n        at com.algolia.instantsearch.ui.databinding.BindingHelper.setVariantForView(BindingHelper.java:100)\r\n        at com.algolia.instantsearch.ui.views.Hits.<init>(Hits.java:142)\r\n        at java.lang.reflect.Constructor.newInstance0(Native Method) \r\n        at java.lang.reflect.Constructor.newInstance(Constructor.java:334) \r\n        at android.view.LayoutInflater.createView(LayoutInflater.java:647) \r\n        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) \r\n        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) \r\n        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) \r\n        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) \r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) \r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) \r\n        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) \r\n        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) \r\n        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) \r\n        at com.rsg.SciSearch.MainActivity.onCreate(MainActivity.kt:30) \r\n        at android.app.Activity.performCreate(Activity.java:7009) \r\n        at android.app.Activity.performCreate(Activity.java:7000) \r\n        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) \r\n        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) \r\n        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) \r\n        at android.app.ActivityThread.-wrap11(Unknown Source:0) \r\n        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) \r\n        at android.os.Handler.dispatchMessage(Handler.java:106) \r\n        at android.os.Looper.loop(Looper.java:164) \r\n        at android.app.ActivityThread.main(ActivityThread.java:6494) \r\n        at java.lang.reflect.Method.invoke(Native Method) \r\n        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) \r\n        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) \r\n08-07 20:18:01.950 9885-9885/com.rsg.SciSearch E/CrashlyticsCore: Failed to execute task.\r\n```\r\n\r\n#### activity_main.xml\r\n```\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<LinearLayout\r\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    xmlns:algolia=\"http://schemas.android.com/apk/res-auto\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:id=\"@+id/activity_main\"\r\n    android:orientation=\"vertical\">\r\n        <com.algolia.instantsearch.ui.views.Hits\r\n            android:layout_width=\"match_parent\"\r\n            android:layout_height=\"wrap_content\"\r\n            algolia:itemLayout=\"@layout/hits_item\"/>\r\n    </LinearLayout>\r\n```\r\n\r\n> Note that there are comments above the LinearLayout in my actual code (in activity_main) so the line 47 displayed in the error is: \r\n\r\n```\r\n<com.algolia.instantsearch.ui.views.Hits\r\n```\r\n\r\n#### hits_item.xml\r\n```\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<layout xmlns:algolia=\"http://schemas.android.com/apk/res-auto\">\r\n    <LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\"\r\n        android:orientation=\"horizontal\">\r\n\r\n        <ImageView\r\n            android:id=\"@+id/product_image\"\r\n            android:layout_width=\"100dp\"\r\n            android:layout_height=\"100dp\"\r\n            android:layout_margin=\"10dp\"\r\n            android:scaleType=\"fitCenter\"\r\n            algolia:attribute='@{\"image\"}'/>\r\n\r\n        <TextView\r\n            android:id=\"@+id/product_name\"\r\n            android:layout_width=\"wrap_content\"\r\n            android:layout_height=\"wrap_content\"\r\n            algolia:attribute='@{\"name\"}'/>\r\n\r\n        <TextView\r\n            android:id=\"@+id/product_price\"\r\n            android:layout_width=\"wrap_content\"\r\n            android:layout_height=\"wrap_content\"\r\n            algolia:attribute='@{\"salePrice\"}'/>\r\n    </LinearLayout>\r\n</layout>\r\n```\r\n\r\n#### MainActivity.kt\r\n```\r\nclass MainActivity : AppCompatActivity() {\r\n    private val ALGOLIA_APP_ID = \"latency\"\r\n    private val ALGOLIA_SEARCH_API_KEY = \"3d9875e51fbd20c7754e65422f7ce5e1\"\r\n    private val ALGOLIA_INDEX_NAME = \"bestbuy\"\r\n\r\n    override fun onCreate(savedInstanceState: Bundle?) {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_main)\r\n\r\n        val searcher = Searcher.create(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME)\r\n        val helper = InstantSearch(this, searcher)\r\n        helper.search()\r\n    }\r\n}\r\n```\r\n\r\n### Please help me resolve this issue."},"comment":{"url":"https://api.github.com/repos/algolia/instantsearch-android/issues/comments/411308743","html_url":"https://github.com/algolia/instantsearch-android/issues/96#issuecomment-411308743","issue_url":"https://api.github.com/repos/algolia/instantsearch-android/issues/96","id":411308743,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTMwODc0Mw==","user":{"login":"radi-cho","id":12954909,"node_id":"MDQ6VXNlcjEyOTU0OTA5","avatar_url":"https://avatars3.githubusercontent.com/u/12954909?v=4","gravatar_id":"","url":"https://api.github.com/users/radi-cho","html_url":"https://github.com/radi-cho","followers_url":"https://api.github.com/users/radi-cho/followers","following_url":"https://api.github.com/users/radi-cho/following{/other_user}","gists_url":"https://api.github.com/users/radi-cho/gists{/gist_id}","starred_url":"https://api.github.com/users/radi-cho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radi-cho/subscriptions","organizations_url":"https://api.github.com/users/radi-cho/orgs","repos_url":"https://api.github.com/users/radi-cho/repos","events_url":"https://api.github.com/users/radi-cho/events{/privacy}","received_events_url":"https://api.github.com/users/radi-cho/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T07:08:41Z","updated_at":"2018-08-08T07:08:41Z","author_association":"NONE","body":"I found two mistakes in my code:\r\n\r\n1. **Missing context.** My Linear layout had no context attribute.\r\n2. **Missing id.** My algolia Hits element was missing id.\r\n\r\nFixing these mistakes solved the main issue."}}
{"actor":{"display_login":"radi-cho"}}