I. AAPT: error: unescaped apostrophe in string </ font>
Cause analysis of error reporting
When doing the internationalization multilingual function, I defined some strings in the arrays.xml file as follows
<item>My name's Lisa</item>
The error report is translated as the apostrophe
that is not replaced by the string. Therefore, I thought that the error report may be caused by
'
, so I replaced the above code with the following code to solve the error report.
<item>My name"s Lisa</item>
Error reporting solution
apostrophe '
available & amp; quot;
replacement, such as: <item> My name& quot; s Lisa
you can use double quotation marks to enclose string resources, such as: <item>" My name's Lisa"
escape characters can be used before apostrophe '
, such as: <item> My name\'s Lisa
II. Multiple substitutions specified in non positive format
Cause analysis of error reporting
First, I defined some strings in the string. XML file
<string name = "upgrade_time"> Driver board: %s\t\t signal version.%s</string>
Error reporting translates to multiple substitutions specified in a non location format. The error reporting prompt mentions setting formatted = "false"
, so I change the above code to the following one, so I won’t run error reporting.
<string name = "upgrade_time" formatted="false"> Driver board: %s\t\t signal version.%s</string>
Error resolution
After reviewing some blog posts and trying it out myself, there are these ways to fix the above error.
Add formatted="false"
attribute in the string with %%
to indicate a %
Third, some common HTML special character encoding
In the Android xml file, involving some special characters may be reported in the display of the error, you need to use HTML special characters to convert.
Special symbols | HTML encoding |
---|---|
& | & |
> | > |
< | < |
> | > |
’ | " |
> | > |
Half a blank space | ensp; |
A blank space |   |
> | > |
Read More:
- Android Package Error: AAPT: error: IDAT: incorrect data check. AAPT: error: file failed to compile.
- [Solved] AS Warning: String literal in setText can not be translated. Use Android resources instead.
- Error in node when PM2 starts multiple processes in docker
- [Solved] AAPT: error: resource android:attr/lStar not found
- Plink Error: Multiple instances of ‘_’ in sample ID.?
- [Solved] Flutter – AAPT: error: resource android:attr/dialogCornerRadius not found.
- [Solved] Android Studio Error: AAPT: error: file failed to compile
- [Solved] Compile Error: AAPT: error: resource android:attr/lStar not found
- [Solved] Android Studio Manifest merger failed with multiple errors, see logs
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]
- C++ Primer Program in VsCode error: no match for call to ‘(std::__cxx11::string…)
- Android Studio Error: String index out of range 0 [How to Solve]
- [Solved] ambiguous import: found package github.com/spf13/cobra/cobra in multiple modules
- Android Error: Failure [INSTALL_FAILED_USER_RESTRICTED: Invalid apk] in android
- How to Solve brew ERROR in `initialize‘: Version value must be a string; got a NilClass ()
- Runtime error prompt in Android Studio: arrayadapter requires the resource ID to be a textview problem
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- Testlink 1.9.16 Error: Fatal error: Uncaught Error: Cannot use string offset as an array in D:\softe
- AAPT2 error: check logs for details [How to Solve]
- Flash back problem when Android studio plays music in sdcard through intent