title: long SVG Asset file error : R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE
body: <p>I'm having some problems with Android Studio at the moment because I recently started using "Vector Assets". I've done absolutely everything necessary to display them correctly in my application (using the <code>app:srcCompat=""</code> in the xml, <code>android {defaultConfig {vectorDrawables.useSupportLibrary true}}</code> in the build.gradle, and <code>AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);</code> in the <em>onCreate()</em> method before <em>setContentView()</em>).</p>
  
  <p>The svg files I imported into Android Studio do not have errors themselves, I can see the result without any problem in an ImageView with the wizard. The only problem comes when I run my application and it arrives at the time to draw the svg. Some of my svg's still work, while others don't, so I think some of them take too long to process.
  Here is the error :</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.retroverse.bataille_corse, PID: 18807
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.retroverse.bataille_corse/com.retroverse.bataille_corse.MenuPrincipal}: android.view.InflateException: Binary XML file line #127: Binary XML file line #127: Error inflating class ImageView
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2985)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3120)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:201)
          at android.app.ActivityThread.main(ActivityThread.java:6872)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
       Caused by: android.view.InflateException: Binary XML file line #127: Binary XML file line #127: Error inflating class ImageView
       Caused by: android.view.InflateException: Binary XML file line #127: Error inflating class ImageView
       Caused by: android.content.res.Resources$NotFoundException: Drawable com.retroverse.bataille_corse:drawable/card_49_en with resource ID #0x7f060099
       Caused by: android.content.res.Resources$NotFoundException: File res/drawable/card_49_en.xml from drawable resource ID #0x7f060099
          at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:854)
          at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:634)
          at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:329)
          at android.content.res.Resources.getDrawableForDensity(Resources.java:902)
          at android.content.res.Resources.getDrawable(Resources.java:841)
          at android.content.Context.getDrawable(Context.java:644)
          at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:454)
          at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:144)
          at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
          at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
          at androidx.appcompat.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59)
          at androidx.appcompat.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:78)
          at androidx.appcompat.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:68)
          at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:187)
          at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:107)
          at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
          at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
          at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
          at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
          at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
          at com.retroverse.bataille_corse.MenuPrincipal.onCreate(MenuPrincipal.java:24)
          at android.app.Activity.performCreate(Activity.java:7232)
  E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:7221)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2965)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3120)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:201)
          at android.app.ActivityThread.main(ActivityThread.java:6872)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
       Caused by: java.lang.IllegalArgumentException: R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE
          at android.util.PathParser.nCreatePathDataFromString(Native Method)
          at android.util.PathParser.access$200(PathParser.java:24)
          at android.util.PathParser$PathData.&lt;init&gt;(PathParser.java:76)
          at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:2016)
          at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1967)
          at android.graphics.drawable.VectorDrawable.inflateChildElements(VectorDrawable.java:819)
          at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:717)
          at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
          at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332)
          at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1291)
          at android.content.res.ResourcesImpl.createFromXmlForDensity(ResourcesImpl.java:1506)
          at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:838)
              ... 41 more
  </code></pre>
  
  <p>The most important line, I think, is <code>Caused by: java.lang.IllegalArgumentException: R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE</code>.
  We also know that this svg was caught in the middle (its size is 187 kilobytes). So I think my SVG file (even imported in Android Studio by "Vector Asset") is too heavy.
  As we are told <a href="https://brightinventions.pl/blog/string-too-large-in-android-resources/" rel="noreferrer">here</a>, the STRING_TOO_LARGE issue appears when the string "is longer than 0x7FFF = 32767 characters". (In the reproduction part)
  Indeed, the only svg to work in my application are lighter than 32 kb, which could explain this.</p>
  
  <p>But I really need to display this svg (don't offer to convert it to png!) correctly, and if possible without optimizing its paths.
  Any help would be welcome!</p>