title: App crashing in Desire HD
body: <p>My app for some inexplicable reasons is crashing on an HTC Desire HD. It's working fine in other phones as well as the emulator. Here is the crash report:</p>
  
  <pre><code>"java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.HomeActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class android.widget.EditText
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2833)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
      at android.app.ActivityThread.access$2300(ActivityThread.java:136)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:143)
      at android.app.ActivityThread.main(ActivityThread.java:5068)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:521)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      at dalvik.system.NativeStart.main(Native Method)
  Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class android.widget.EditText
      at android.view.LayoutInflater.createView(LayoutInflater.java:513)
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
      at android.app.Activity.setContentView(Activity.java:1686)
      at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
      ... 11 more
  Caused by: java.lang.reflect.InvocationTargetException
      at android.widget.EditText.&lt;init&gt;(EditText.java:53)
      at java.lang.reflect.Constructor.constructNative(Native Method)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
      at android.view.LayoutInflater.createView(LayoutInflater.java:500)
      ... 26 more
  Caused by: java.lang.NullPointerException
      at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
      at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
      at android.widget.TextView.setText(TextView.java:2712)
      at android.widget.TextView.setText(TextView.java:2590)
      at android.widget.EditText.setText(EditText.java:84)
      at android.widget.TextView.setText(TextView.java:2565)
      at android.widget.TextView.setTransformationMethod(TextView.java:1209)
      at android.widget.TextView.applySingleLine(TextView.java:6024)
      at android.widget.TextView.setSingleLine(TextView.java:6015)
      at android.widget.TextView.setSingleLine(TextView.java:5992)
      at android.widget.TextView.&lt;init&gt;(TextView.java:863)
      at android.widget.EditText.&lt;init&gt;(EditText.java:57)
      ... 30 more
  android.view.InflateException: Binary XML file line #30: Error inflating class android.widget.EditText
      at android.view.LayoutInflater.createView(LayoutInflater.java:513)
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
      at android.app.Activity.setContentView(Activity.java:1686)
      at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
      at android.app.ActivityThread.access$2300(ActivityThread.java:136)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:143)
      at android.app.ActivityThread.main(ActivityThread.java:5068)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:521)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.reflect.InvocationTargetException
      at android.widget.EditText.&lt;init&gt;(EditText.java:53)
      at java.lang.reflect.Constructor.constructNative(Native Method)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
      at android.view.LayoutInflater.createView(LayoutInflater.java:500)
      ... 26 more
  Caused by: java.lang.NullPointerException
      at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
      at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
      at android.widget.TextView.setText(TextView.java:2712)
      at android.widget.TextView.setText(TextView.java:2590)
      at android.widget.EditText.setText(EditText.java:84)
      at android.widget.TextView.setText(TextView.java:2565)
      at android.widget.TextView.setTransformationMethod(TextView.java:1209)
      at android.widget.TextView.applySingleLine(TextView.java:6024)
      at android.widget.TextView.setSingleLine(TextView.java:6015)
      at android.widget.TextView.setSingleLine(TextView.java:5992)
      at android.widget.TextView.&lt;init&gt;(TextView.java:863)
      at android.widget.EditText.&lt;init&gt;(EditText.java:57)
      ... 30 more
  java.lang.reflect.InvocationTargetException
      at android.widget.EditText.&lt;init&gt;(EditText.java:53)
      at java.lang.reflect.Constructor.constructNative(Native Method)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
      at android.view.LayoutInflater.createView(LayoutInflater.java:500)
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
      at android.app.Activity.setContentView(Activity.java:1686)
      at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
      at android.app.ActivityThread.access$2300(ActivityThread.java:136)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:143)
      at android.app.ActivityThread.main(ActivityThread.java:5068)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:521)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.NullPointerException
      at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
      at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
      at android.widget.TextView.setText(TextView.java:2712)
      at android.widget.TextView.setText(TextView.java:2590)
      at android.widget.EditText.setText(EditText.java:84)
      at android.widget.TextView.setText(TextView.java:2565)
      at android.widget.TextView.setTransformationMethod(TextView.java:1209)
      at android.widget.TextView.applySingleLine(TextView.java:6024)
      at android.widget.TextView.setSingleLine(TextView.java:6015)
      at android.widget.TextView.setSingleLine(TextView.java:5992)
      at android.widget.TextView.&lt;init&gt;(TextView.java:863)
      at android.widget.EditText.&lt;init&gt;(EditText.java:57)
      ... 30 more
  java.lang.NullPointerException
      at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:300)
      at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:287)
      at android.widget.TextView.setText(TextView.java:2712)
      at android.widget.TextView.setText(TextView.java:2590)
      at android.widget.EditText.setText(EditText.java:84)
      at android.widget.TextView.setText(TextView.java:2565)
      at android.widget.TextView.setTransformationMethod(TextView.java:1209)
      at android.widget.TextView.applySingleLine(TextView.java:6024)
      at android.widget.TextView.setSingleLine(TextView.java:6015)
      at android.widget.TextView.setSingleLine(TextView.java:5992)
      at android.widget.TextView.&lt;init&gt;(TextView.java:863)
      at android.widget.EditText.&lt;init&gt;(EditText.java:57)
      at android.widget.EditText.&lt;init&gt;(EditText.java:53)
      at java.lang.reflect.Constructor.constructNative(Native Method)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
      at android.view.LayoutInflater.createView(LayoutInflater.java:500)
      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
      at android.app.Activity.setContentView(Activity.java:1686)
      at com.myapp.HomeActivity.onCreate(HomeActivity.java:165)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1066)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2797)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
      at android.app.ActivityThread.access$2300(ActivityThread.java:136)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:143)
      at android.app.ActivityThread.main(ActivityThread.java:5068)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:521)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      at dalvik.system.NativeStart.main(Native Method)
  "
  </code></pre>
  
  <p>The crash seems to be happening when setting a value for EditText. Here is the EditText field in the XML:</p>
  
  <pre><code>&lt;EditText style="@style/HomeInput" android:id="@+id/signin_username"
                      android:capitalize="none"
                      android:imeOptions="actionDone"
                      android:inputType="text"
                      android:text=""
                      android:maxLines="1"/&gt;
  </code></pre>
  
  <p>Is anything wrong with the XML? If yes, why is it working in the emulator or other phones?</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>Here is the style XML</p>
  
  <pre><code>  &lt;style name="HomeInput"&gt;
      &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt;
      &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;      
      &lt;item name="android:textSize"&gt;@dimen/text_size_small&lt;/item&gt;
      &lt;item name="android:textColor"&gt;@color/signin_input&lt;/item&gt;
      &lt;item name="android:layout_marginTop"&gt;10dip&lt;/item&gt;
      &lt;item name="android:layout_marginBottom"&gt;5dip&lt;/item&gt;
      &lt;item name="android:layout_marginLeft"&gt;10dip&lt;/item&gt;
      &lt;item name="android:layout_marginRight"&gt;10dip&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p><strong>Edit 2</strong></p>
  
  <p>Submitted the bug report to Google: <a href="http://code.google.com/p/android/issues/detail?id=16640&amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars" rel="nofollow">http://code.google.com/p/android/issues/detail?id=16640&amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars</a></p>
  
  <p><strong>Edit 3</strong></p>
  
  <p>The app crashes with an EditTextPreference inflated from xml/preferences.xml. Here is the crash report:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vtcreator.android360/com.myapp.SettingsActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class java.lang.reflect.Constructor
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2852)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873)
  at android.app.ActivityThread.access$2300(ActivityThread.java:140)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2186)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:143)
  at android.app.ActivityThread.main(ActivityThread.java:5127)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class java.lang.reflect.Constructor
  at android.preference.GenericInflater.createItem(GenericInflater.java:397)
  at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
  at android.preference.GenericInflater.inflate(GenericInflater.java:326)
  at android.preference.GenericInflater.inflate(GenericInflater.java:263)
  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:254)
  at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:268)
  at com.myapp.SettingsActivity.onCreate(SettingsActivity.java:39)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2816)
  ... 11 more
  Caused by: java.lang.reflect.InvocationTargetException
  at android.preference.EditTextPreference.&lt;init&gt;(EditTextPreference.java:71)
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
  at android.preference.GenericInflater.createItem(GenericInflater.java:383)
  ... 22 more
  Caused by: java.lang.NullPointerException
  at com.htc.quickselection.HtcQuickSelectionWindow.&lt;init&gt;(HtcQuickSelectionWindow.java:164)
  at com.htc.textselection.TextSelectionMethodImpl.initAnchorAndMagnifier(TextSelectionMethodImpl.java:326)
  at com.htc.textselection.TextSelectionMethodImpl.initialize(TextSelectionMethodImpl.java:297)
  at android.widget.TextView.setText(TextView.java:2746)
  at android.widget.TextView.setText(TextView.java:2626)
  at android.widget.EditText.setText(EditText.java:82)
  at android.widget.TextView.&lt;init&gt;(TextView.java:924)
  at android.widget.EditText.&lt;init&gt;(EditText.java:57)
  at android.widget.EditText.&lt;init&gt;(EditText.java:53)
  at android.preference.EditTextPreference.&lt;init&gt;(EditTextPreference.java:56)
  ... 26 more
  </code></pre>