I’m trying to learn some android programming for some personal projects and have been following along the Udacity android development in kotlin course. I was happily going along when android studio started blaring red everywhere and giving me the most descriptive error I’ve ever seen.
Index: 1, Size: 1
When you dig down and click some buttons and stuff you will eventually get a more descriptive error:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.Collections$SingletonList.get(Collections.java:4815) at android.databinding.tool.ext.ExtKt.androidId(ext.kt:108) at android.databinding.tool.writer.BaseLayoutModel.readableName(BaseLayoutModel.kt:131) at android.databinding.tool.writer.BaseLayoutModel.fieldName(BaseLayoutModel.kt:103)...
Since I was messing with databindings it’s not that surprising that those classes are involved but what?
So you start wondering, what did I do? I followed the lesson right? WHY IS IT NOT WORKING.
mumbl mumbl stupid errors.. Let’s revert to good old google.
Eventually I come across this post on stackoverflow. So right, if you have an id that lacks a slash (android ids look like
And sure enough I accidentally put a databinding thingy in the id field instead of the text field.
Well I do feel like an idiot now.
Please have better error messages.