最近开始学习Android,拿着一本书就开始鼓捣,一开始看了书本的内容后,导入ApiDemo的项目,谁知道控制台就报错了:
[2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\values\strings.xml:365: error: Apostrophe not preceded by \ (in I'm on! :)) [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\values\strings.xml:366: error: Apostrophe not preceded by \ (in I'm off! :() [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\values\strings.xml:643: error: Apostrophe not preceded by \ (in The Android platform is a software stack for mobile devices including an [2011-09-11 19:30:29 - ApiDemos] operating system, middleware and key applications. Developers can create [2011-09-11 19:30:29 - ApiDemos] applications for the platform using the Android SDK. Applications are written [2011-09-11 19:30:29 - ApiDemos] using the Java programming language and run on Dalvik, a custom virtual [2011-09-11 19:30:29 - ApiDemos] machine designed for embedded use which runs on top of a Linux kernel. [2011-09-11 19:30:29 - ApiDemos] [2011-09-11 19:30:29 - ApiDemos] If you want to know how to develop applications for Android, you're in the [2011-09-11 19:30:29 - ApiDemos] right place. This site provides a variety of documentation that will help you [2011-09-11 19:30:29 - ApiDemos] learn about Android and develop mobile applications for the platform. [2011-09-11 19:30:29 - ApiDemos] [2011-09-11 19:30:29 - ApiDemos] An early look at the the Android SDK is also available. It includes sample [2011-09-11 19:30:29 - ApiDemos] projects with source code, development tools, an emulator, and of course all [2011-09-11 19:30:29 - ApiDemos] the libraries you'll need to build an Android application. What would it take [2011-09-11 19:30:29 - ApiDemos] to build a better mobile phone? [2011-09-11 19:30:29 - ApiDemos] ) [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\layout\scrollbar3.xml:87: error: Error: No resource found that matches the given name (at 'text' with value '@string/scrollbar_3_text'). [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\layout\scrollbar3.xml:100: error: Error: No resource found that matches the given name (at 'text' with value '@string/scrollbar_3_text'). [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\layout\scrollbar3.xml:117: error: Error: No resource found that matches the given name (at 'text' with value '@string/scrollbar_3_text'). [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\layout\scrollbar3.xml:129: error: Error: No resource found that matches the given name (at 'text' with value '@string/scrollbar_3_text'). [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\xml\advanced_preferences.xml:32: error: Error: No resource found that matches the given name (at 'summaryOn' with value '@string/summary_on_advanced_toggle_preference'). [2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\xml\advanced_preferences.xml:32: error: Error: No resource found that matches the given name (at 'summaryOff' with value '@string/summary_off_advanced_toggle_preference'). |
一开始看到这个,居然有点不值所错了,于是上网搜索,发现遇到这个问题的人还真不少,但是没有人说怎么解决。没办法,自己看错误信息,一看,差点晕死….他一开始就告诉我什么问题了【Apostrophe not preceded by \】,单引号前面没有【\】,就这么简单……..手动打开strings.xml,然后把【’】改成【\’】,刷新一次,不报错了……
[2011-09-11 19:30:29 - ApiDemos] D:\Android\android-sdk-windows\platforms\android-4\samples\ApiDemos\res\values\strings.xml:365: error: Apostrophe not preceded by \ (in I'm on! :)) |

敲代码的就更要细心啊
Link | 一月 11th, 2012 at 13:04
确实,作为一个程序员,犯下如此错误让我自己都觉得汗颜
Link | 一月 11th, 2012 at 13:16