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
You can use AAPT (from the android sdk/build-tools) to examine the APK and look for the offending string with the following command line (Linux):
// Linux/Mac
./aapt dump --values resources MyAppName-regular-debug.apk | grep -B 1 'STRING_TOO_LARGE'
// Windows
aapt dump --values resources MyAppName-regular-debug.apk | grep -B 1 'STRING_TOO_LARGE'
Which should point you to the culprit. In my case it was:
resource 0x7f0f015a com.example.app:string/eula: t=0x03 d=0x00000f10 (s=0x0008 r=0x00)
(string8) "STRING_TOO_LARGE"
I've been hunting for the source of STRING_TOO_LARGE errors in our build for a long time and none of these solutions worked. The reason none of them worked was that I had progaurd turned on in debug builds so when the string was replaced it didn't end up in the apk. When i disabled progaurd for debug builds, built the apk and then decompiled with apktool as suggested elsewhere
java -jar apktool_2.4.1.jar d debug.apk
and found the xml file that was in another library but progaurd stripped out before:
grep -r "STRING_TOO_LARGE" ./debug
Hope that helps someone
Finding the file with the error: use a online decompiler if it's not a problem is some one else sees your code. Download .zip file. Open up notepad++ search -> Find in files -> STRING_TOO_LARGE -> Find all
.
If the problem file is a vector asset:
Vikasdeep Singh has a great solution: avocado. Avocado will make the vector file smaller.
None of the above solutions worked for me. What ended up being the cause of the problem was, as it states, a String that was too large. Specifically, in my arrays.xml file under the values directory, I had some SVG arrays that were used within my app and commenting them out solved the issue.
If you know for certain you have some longer Strings somewhere in your resource directories (/res), check for any large Strings that may be lurking.
Also, this solution may help others but was not linked to in this thread.
clear your gradle in windows
gradlew cleanBuildCache
in mac
./gradlew cleanBuildCache
then building you apk if your project has problem it will be show you in the 'Messages' view. location your problem and fix it. run agent.
In my case, i deleted a view from xml but forgot to remove its references in my kotlin code. Make sure to check this before doing anything fancy.