title: Android Studio XML Render Problem - String Index Out Of Range:-1
body: <p>When I adding <code>android:autoFillHints=&quot;&quot;</code> attribute to the XML code of activity, design screen suddenly started giving an error.</p>
  <p>First, the activity layout that I editing did not show anything on the design screen and there was error in just the activity layout that I editing. Then, I tried to solve there are my steps which did not work (nothing else worked.):</p>
  <ol>
  <li>I change the API version to 29 and 28 from 30. It did not worked.</li>
  <li>I rewrite all the XML code at the activity layout that I editted. It did not worked.</li>
  </ol>
  <p>I search Google and Stack Over Flow but I did not see any solve. The answers were about JavaFX or pure java code that String index is out of range.</p>
  <p>After that, I decided to edit other activity layouts and when I edit other activity layouts started giving errors.</p>
  <p>The XML file that I get error is:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.noteDetails&quot;
      android:paddingHorizontal=&quot;20dp&quot;
      android:orientation=&quot;vertical&quot;&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;20dp&quot;
          android:layout_marginBottom=&quot;20dp&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/textView3&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:fontFamily=&quot;@font/ubuntubold&quot;
              android:text=&quot;@string/note_details&quot;
              android:textColor=&quot;@color/yellow&quot;
              android:textSize=&quot;25sp&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              tools:ignore=&quot;MissingConstraints&quot; /&gt;
  
          &lt;ImageButton
              android:id=&quot;@+id/saveNoteButton&quot;
              android:layout_width=&quot;30dp&quot;
              android:layout_height=&quot;30dp&quot;
              android:background=&quot;@drawable/ic_save_note_changes&quot;
              android:visibility=&quot;gone&quot;
              android:backgroundTint=&quot;@color/green&quot;
              android:layout_marginEnd=&quot;20dp&quot;
              app:layout_constraintEnd_toStartOf=&quot;@id/deleteNoteButton&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              android:contentDescription=&quot;@string/save_updates_button&quot; /&gt;
  
          &lt;ImageButton
              android:id=&quot;@+id/editNoteButton&quot;
              android:layout_width=&quot;30dp&quot;
              android:layout_height=&quot;30dp&quot;
              android:background=&quot;@drawable/ic_edit_note&quot;
              android:backgroundTint=&quot;@color/blue&quot;
              android:layout_marginEnd=&quot;20dp&quot;
              app:layout_constraintEnd_toStartOf=&quot;@id/deleteNoteButton&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              android:contentDescription=&quot;@string/edit_note_button&quot; /&gt;
  
          &lt;ImageButton
              android:id=&quot;@+id/deleteNoteButton&quot;
              android:layout_width=&quot;30dp&quot;
              android:layout_height=&quot;30dp&quot;
              android:background=&quot;@drawable/ic_delete_note&quot;
              android:backgroundTint=&quot;@color/pink&quot;
              app:layout_constraintEnd_toStartOf=&quot;@+id/goBackButton&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              android:layout_marginEnd=&quot;20dp&quot;
              android:contentDescription=&quot;@string/delete_note_button&quot; /&gt;
  
          &lt;ImageButton
              android:id=&quot;@+id/goBackButton&quot;
              android:layout_width=&quot;30dp&quot;
              android:layout_height=&quot;30dp&quot;
              android:background=&quot;@drawable/ic_go_back&quot;
              android:backgroundTint=&quot;@color/darkblue&quot;
              app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot;
              android:contentDescription=&quot;@string/go_to_main_menu_button&quot; /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
      &lt;View
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;10dp&quot;
          android:background=&quot;@drawable/horizontal_line&quot;/&gt;
  
      &lt;LinearLayout
          android:id=&quot;@+id/editNoteLinearLayout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;vertical&quot;
          android:layout_marginVertical=&quot;20dp&quot;
          android:padding=&quot;8dp&quot;
          android:background=&quot;@drawable/ic_note_detailed_text_frame&quot;&gt;
          
          &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;10dp&quot;
              android:layout_marginBottom=&quot;10dp&quot;&gt;
  
              &lt;EditText
                  android:id=&quot;@+id/noteTitleDetailed&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:fontFamily=&quot;@font/ubunturegular&quot;
                  android:textStyle=&quot;bold&quot;
                  android:hint=&quot;@string/note_title&quot;
                  android:background=&quot;@null&quot;
                  android:inputType=&quot;text&quot;
                  android:textSize=&quot;20sp&quot;
                  android:textColor=&quot;@color/darkblue&quot;
                  android:maxLength=&quot;30&quot;
                  app:layout_constraintStart_toStartOf=&quot;parent&quot;
                  tools:ignore=&quot;MissingConstraints&quot;
                  android:autofillHints=&quot;&quot; /&gt;
  
              &lt;View
                  android:layout_width=&quot;100dp&quot;
                  android:layout_height=&quot;3dp&quot;
                  android:layout_gravity=&quot;start&quot;
                  android:layout_marginTop=&quot;5dp&quot;
                  android:background=&quot;@drawable/ic_note_title_and_text_divider&quot;
                  app:layout_constraintTop_toBottomOf=&quot;@id/noteTitleDetailed&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                  tools:ignore=&quot;MissingConstraints&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/noteDateDetailed&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:fontFamily=&quot;@font/ubuntulight&quot;
                  android:textSize=&quot;12sp&quot;
                  android:layout_marginTop=&quot;5dp&quot;
                  android:text=&quot;@string/example_date&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                  app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                  app:layout_constraintTop_toBottomOf=&quot;@id/noteTitleDetailed&quot;/&gt;
  
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
          &lt;EditText
              android:id=&quot;@+id/noteTextDetailed&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:inputType=&quot;text&quot;
              android:fontFamily=&quot;@font/ubunturegular&quot;
              android:textSize=&quot;16sp&quot;
              android:textColor=&quot;@color/darkblue&quot;
              android:hint=&quot;@string/note_content&quot;
              android:lines=&quot;10&quot;
              android:ems=&quot;10&quot;
              android:maxLength=&quot;500&quot;
              android:background=&quot;@null&quot;
              tools:ignore=&quot;MissingConstraints&quot;
              android:layout_marginBottom=&quot;10dp&quot;
              android:autofillHints=&quot;&quot; /&gt;
          
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>I control the code again and again and I did not notice any problem about XML code. And when I compile the code, program run with not problem.</p>
  <p>Error codes and images are:</p>
  <p>Render Problem Error Code:</p>
  <pre><code>java.lang.reflect.InvocationTargetException
      at jdk.internal.reflect.GeneratedMethodAccessor953.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at android.view.BridgeInflater.lambda$createViewFromCustomInflater$0(BridgeInflater.java:259)
      at android.view.BridgeInflater.createViewFromCustomInflater(BridgeInflater.java:285)
      at android.view.BridgeInflater.onCreateView(BridgeInflater.java:122)
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:928)
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:948)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1002)
      at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:309)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1121)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:354)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:431)
      at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:710)
      at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:865)
      at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:174)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
  Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
      at java.base/java.lang.String.charAt(String.java:693)
      at android.content.res.BridgeTypedArray.getType(BridgeTypedArray.java:1024)
      at android.content.res.BridgeTypedArray.getType(BridgeTypedArray.java:809)
      at android.content.res.BridgeTypedArray.getValue(BridgeTypedArray.java:778)
      at android.content.res.BridgeTypedArray.peekValue(BridgeTypedArray.java:847)
      at android.view.View.&lt;init&gt;(View.java:5951)
      at android.widget.TextView.&lt;init&gt;(TextView.java:996)
      at android.widget.EditText.&lt;init&gt;(EditText.java:87)
      at android.widget.EditText.&lt;init&gt;(EditText.java:83)
      at androidx.appcompat.widget.AppCompatEditText.&lt;init&gt;(AppCompatEditText.java:93)
      at androidx.appcompat.widget.AppCompatEditText.&lt;init&gt;(AppCompatEditText.java:88)
      at androidx.appcompat.app.AppCompatViewInflater.createEditText(AppCompatViewInflater.java:209)
      at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:127)
      ... 34 more
  </code></pre>
  <p>Render Problem Error Image:
  <a href="https://i.stack.imgur.com/bTI43.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bTI43.png" alt="Render Problem Error Image" /></a></p>
  <p>Stack Trace Error Code:</p>
  <pre><code>java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
      at java.base/java.lang.String.charAt(String.java:693)
      at android.content.res.BridgeTypedArray.getType(BridgeTypedArray.java:1024)
      at android.content.res.BridgeTypedArray.getType(BridgeTypedArray.java:809)
      at android.content.res.BridgeTypedArray.getValue(BridgeTypedArray.java:778)
      at android.content.res.BridgeTypedArray.peekValue(BridgeTypedArray.java:847)
      at android.view.View.&lt;init&gt;(View.java:5951)
      at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:697)
      at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:99)
      at com.android.layoutlib.bridge.MockView.&lt;init&gt;(MockView.java:55)
      at com.android.layoutlib.bridge.MockView.&lt;init&gt;(MockView.java:51)
      at com.android.layoutlib.bridge.MockView.&lt;init&gt;(MockView.java:47)
      at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:324)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1121)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124)
      at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
      at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:354)
      at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:431)
      at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141)
      at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:710)
      at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:865)
      at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:174)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  <p>Stack Trace Error Image:
  <a href="https://i.stack.imgur.com/EEOzG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EEOzG.png" alt="Stack Trace Error Image" /></a></p>
  <p>If anything is missing, let me know and I'll add it right away. Thank you from now.</p>