android studio with Java compiler error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'

后端 未结 16 1154
北恋
北恋 2020-12-03 06:45

When I clean the android project in android studio, the error happen, I have backed to previous commit or different branch, which works find couple days ago, but has this er

相关标签:
16条回答
  • 2020-12-03 07:17

    In my case, the problem was due to the following lines in the manifest:

        <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"/>
    

    Once I deleted them, the build went fine.

    0 讨论(0)
  • 2020-12-03 07:19

    Just use gradlew cleanBuildCache in your Android studio terminal

    0 讨论(0)
  • 2020-12-03 07:23

    I was stuck on this problem and read through this topic and no one provided a future solution. I did NOT want to revert back my Gradle. Therefore, here is the link to the updated dependencies https://github.com/stripe/stripe-android. Look for the "Android Studio (or Gradle)" section and you should see this "implementation 'com.stripe:stripe-android:8.1.0'" also you might need to add "-keep class com.stripe.android.** { *; }" if you are enabling minification in your build.gradle file.

    Overall Stripe has stopped updating their own "Stripe docs" which can be found here. To give them credit their docs are helpful and should be read at least once, but be mindful that most of the docs are out date when I wrote this...

    Hope this helps :)

    0 讨论(0)
  • 2020-12-03 07:23

    just use <?xml version="1.0" encoding="utf-8"?> before in your drawable file.

    Example:

    <?xml version="1.0" encoding="utf-8"?>
    <vector
        android:autoMirrored="true"
        android:height="24dp"
        android:viewportHeight="490.282"
        android:viewportWidth="490.282"
        android:width="24dp"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <path
            android:fillColor="#fff"
            android:pathData="M0.043,245.197c0.6,10.1 7.3,18.6 17,21.5l179.6,54.3l6.6,123.8c0.3,4.9 3.6,9.2 8.3,10.8c1.3,0.5 2.7,0.7 4,0.7c3.5,0 6.8,-1.4 9.2,-4.1l63.5,-70.3l90,62.3c4,2.8 8.7,4.3 13.6,4.3c11.3,0 21.1,-8 23.5,-19.2l74.7,-380.7c0.9,-4.4 -0.8,-9 -4.2,-11.8c-3.5,-2.9 -8.2,-3.6 -12.4,-1.9l-459,186.8C5.143,225.897 -0.557,235.097 0.043,245.197zM226.043,414.097l-4.1,-78.1l46,31.8L226.043,414.097zM391.443,423.597l-163.8,-113.4l229.7,-222.2L391.443,423.597zM432.143,78.197l-227.1,219.7l-179.4,-54.2L432.143,78.197z"/>
    </vector>
    
    0 讨论(0)
  • 2020-12-03 07:23

    For me "gradlew cleanBuildCache" did not work, and running aapt dump --values resources MyAppName-regular-debug.apk | grep -B 1 'STRING_TOO_LARGE' did nothing either...

    I ended up just deleting all my vector images since they were all pretty large and that fixed my build.. So I guess I'll have to add those back in a way that does not throw the error again..

    0 讨论(0)
  • 2020-12-03 07:26

    I found the answer from a duplicate question for Kotlin from here

    Add <?xml version="1.0" encoding="utf-8"?> to the top of any resource .xml file that is missing it. (check your layout xml files, specially)

    0 讨论(0)
提交回复
热议问题