StackExchange Friday: Another example of stupid Android architecture
Excerpts from: Android relative layout background crash
The Question:
On loading an exception is raised: android.view.InflateException at the RelativeLayout's line. If I remove "android:background", everything works perfect. What's wrong with my_shape_normal?
The Answer:
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6
<gradient> tag requires 'angle' attribute to be a multiple of 45
That's right: the angle of a gradient is defined as an integer, but you can only provide integer values that are multiples of 45. What happens when you don't? Your application crashes. You want a different angle? Too bad.
Now, it's reasonable to expect that developers will encounter this error throughout the course of their usual development, and will fix it. This is just another one of those items on the list of tribal knowledge an Android developer must acquire. The chances of this getting out in the wild are slim to none, but you gotta know it.
This is dumb, why? Perhaps Google didn't specify the angle property as an enumeration or something else because they expect to support all angles in a future version, and don't want to deal with a data type change when that happens. But that points out a lack of attention to the consumers of their stuff. Let's be clear: Google is perfectly fine with crashing your app in development rather than providing an API that accurately describes its data, only the most basic of design considerations for any framework. Google doesn't love developers.
The Question:
On loading an exception is raised: android.view.InflateException at the RelativeLayout's line. If I remove "android:background", everything works perfect. What's wrong with my_shape_normal?
The Answer:
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6
<gradient> tag requires 'angle' attribute to be a multiple of 45
That's right: the angle of a gradient is defined as an integer, but you can only provide integer values that are multiples of 45. What happens when you don't? Your application crashes. You want a different angle? Too bad.
Now, it's reasonable to expect that developers will encounter this error throughout the course of their usual development, and will fix it. This is just another one of those items on the list of tribal knowledge an Android developer must acquire. The chances of this getting out in the wild are slim to none, but you gotta know it.
This is dumb, why? Perhaps Google didn't specify the angle property as an enumeration or something else because they expect to support all angles in a future version, and don't want to deal with a data type change when that happens. But that points out a lack of attention to the consumers of their stuff. Let's be clear: Google is perfectly fine with crashing your app in development rather than providing an API that accurately describes its data, only the most basic of design considerations for any framework. Google doesn't love developers.
Comments
Post a Comment