我在strings.xml文件中写了以下内容:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
The reference to entity "Drop" must end with the ';' delimiter.
Run Code Online (Sandbox Code Playgroud)
我怎样才能在strings.xml中写字符?
可能重复:
Android XML百分比符号
你好伙伴我在文件xml中有一个数组:
<string-array name="type_data_graph">
<item>Veichle speed (Km/h)</item>
<item>Engine Rpm (rpm)</item>
<item>Barometric pressure (kPa absolute)</item>
<item>Fuel pressure (kPa)</item>
<item>Fuel Rail pressure of manifold vacuum (kPa)</item>
<item>Fuel Rail pressure diesel/gasoline (kPa)</item>
<item>MAF air flow rate (grams/sec)</item>
<item>Intake MAP (kPa)</item>
<item>Engine % torque (%) </item>
......
</string-array>
Run Code Online (Sandbox Code Playgroud)
当commpile我得到错误
<item>Engine % torque (%) </item>
Run Code Online (Sandbox Code Playgroud)
错误是
说明资源路径位置类型错误:以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?arrays.xml/DashboardDroid/res/values line 43 Android AAPT问题
说明资源路径位置类型错误:找到标签所在的array.xml/DashboardDroid/res/values line 43 Android AAPT问题是什么意思??? 我关闭所有标签
我想在我的strings.xml文件中创建以下字符串数组:
<string-array name="an_array_columns">
<item>% Select percentage1</item>
<item>% Select percentage2</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
这里的字符串是"%select percentage".现在,当我在strings.xml中写这个时,我收到以下错误:
Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to
add the formatted="false" attribute?
- error: Found tag </item> where </string-array> is expected
Run Code Online (Sandbox Code Playgroud)
我知道我们可以改变&到&或'到\'的,但我该怎么为百分号吗?
在Gingerbread发布后,我将ADT更新到最新版本.现在
<string name="date_format">%d:%d %s</string>
Run Code Online (Sandbox Code Playgroud)
显示以下错误
Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false"
attribute?
- error: Unexpected end tag string
Run Code Online (Sandbox Code Playgroud)
以前的ADT版本运行良好.难道我做错了什么?只要有超过1个格式说明符,我就会收到此错误.
我有一个Android应用程序,它抛出BUILD进程跟随错误:
/home/Ralf/Projekte/University/android-sampleapp/sampleapp/build/intermediates/bundles/debug/res/values-de/values-de.xml错误:(88,5)以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?错误:(88,5)意外的结束标记字符串
/home/Ralf/Projekte/University/android-sampleapp/sampleapp/build/intermediates/bundles/debug/res/values/values.xml错误:(106,5)以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?错误:(106,5)意外的结束标记字符串
/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/res/merged/debug/values-de/values-de.xml错误:(131)以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?错误:(131)意外的结束标记字符串
/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/res/merged/debug/values/values.xml错误:(1258)以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?错误:(1258)意外的结束标记字符串错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:执行进程/opt/sdk/build-tools/26.0.2/aapt时出错参数{package -f --no-crunch -I /opt/sdk/platforms/android-27/android.jar -M/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/manifests/full /debug/AndroidManifest.xml -S/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/res/merged/debug -m -J/home/Ralf/Projekte/University/android-sampleapp/demo/build/generated/source/r/debug -F /home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/res/debug/resources-debug.ap_ -D/home/Ralf/Projekte/University /android-sampleapp/demo/build/intermediates/multi-dex/debug/manifest_keep.txt --custom-package com.ralfi.demo -0 apk --output-text-symbols/home/Ralf/Projekte/University/android -sampleapp/demo/build/intermediates/symbols/debug --no-version-vectors}错误:com.android.ide.comm on.process.ProcessException:使用参数执行进程/opt/sdk/build-tools/26.0.2/aapt时出错{package -f --no-crunch -I/opt/sdk/platforms/android-27/android. jar -M /home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/manifests/full/debug/AndroidManifest.xml -S/home/Ralf/Projekte/University/android-sampleapp/demo/build /中间体/ res/merged/debug -m -J/home/Ralf/Projekte /大学/ android-sampleapp/demo/build/generated/source/r/debug -F/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/res/debug/resources-debug.ap_ -D /home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/multi-dex/debug/manifest_keep.txt --custom-package com.ralfi.demo -0 apk --output-text-symbols/home/Ralf/Projekte/University/android-sampleapp/demo/build/intermediates/symbols/debug --no-version-vectors}错误:org.gradle .process.internal.ExecException:进程'命令'/opt/sdk/build-tools/26.0.2/aapt''以非零退出va结束 lue 1
当我点击字符串resrouces中的错误时,它指向:隐藏%02d:%02d min
但我需要翻译这些资源,为什么我得到这个?
构建项目会从AAPT引发以下错误.我重建了这个项目,但它仍然失败了.我找不到任何关于此错误代码实际意味着什么的引用.我在使用ActionBarSherlock v4.1.0的IntelliJ中使用Java 6和Android工具r19.
I/O error: Command
"C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar"
execution failed with exit code -1073741819
Run Code Online (Sandbox Code Playgroud)
在我从项目向ActionBarSherlock库项目添加依赖项之后,此构建失败开始发生.如果我删除该依赖项,项目构建正常.如果我将其添加回来,它会再次失败.
在<string-array name ="versions">我有一个条目的野兽(煮沸到合理的最小值来重现效果):
<item>100% foo 40%bar</item>
Run Code Online (Sandbox Code Playgroud)
产生这些错误:
Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
- error: Found tag </item> where </string-array> is expected
Run Code Online (Sandbox Code Playgroud)
添加formatted ="false"不会改变任何事情.
<item>100% foo 40%bar</item>
Run Code Online (Sandbox Code Playgroud)
导致相同的错误消息.WTH?
<item>100% foo 40bar</item>
<item>100 foo 40%bar</item>
<item>100% foo 40%</item>
Run Code Online (Sandbox Code Playgroud)
一切都会好起来的.用\%转义它只是被忽略导致相同的错误.%%不会导致错误,但我得到%%.
基本上,我需要帮助导入下载的源代码或从示例源程序创建项目.如果有人能指出我或发布步骤,我正在寻找一步一步的指示.
我是Android/Eclipse的新手.我已经安装了环境,并且已经成功编写了一个非常小的应用程序,可以在模拟器和真正的Droid X上运行.但是,我不能将任何Android样本放入项目中而不会出错.我尝试过导入,从现有的源代码创建,等等,到处都是错误.
但是,我已成功创建了一个新的空项目,然后将组件一次一个地输入到项目中,为每个文件键入或粘贴代码.我会盘旋并根据需要导入Android和其他组件.例如,WiktionarySimple只运行了几个更改和几个警告我独自留下.(我不得不在下面的陈述中添加'formatted ="false")
<string name="template_user_agent" formatted="false">"%s/%s (Linux; Android)"</string>
<string name="template_wotd_title" formatted="false">"Wiktionary:Word of the day/%s %s"</string>
Run Code Online (Sandbox Code Playgroud)
但必须有一种更简单的导入方式!我已经完成了直观的操作,并且我遵循了我发现的说明,但无济于事.任何人都可以给我一个完整的列表,如何从现有的源或从我从网上下载的源导入或创建项目?
我将此行添加到我的strings.xml中,它不会编译成R.
<string name="cl_txt_verinfo">List Version: %1$s\nAuthor: %2$s\nDate Created: %3$s\nLanguage: %4$s</string>
我得到的错误是:
错误:以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?错误:意外的结束标记字符串
我想问一下如何使这个工作(我稍后会使用string.format)和"formatted = false"做什么,而不是添加/添加为true.
编辑:清理和构建是我得到此错误的方式.我得到了这么多次.但后来我删除了一个空行并清理并重建一切都很好.这实际上是不一致的,我不知道是什么原因导致了这个问题.
剩下两个问题:
这不是我唯一一次错误,然后它神奇地修复了自己.有时我重新启动我的adt并且它自行解决,但不是这次可悲的.
我的build.gradle中有一个自定义任务,它会生成一些字符串资源:
android.defaultConfig.resValue "string", "my_string", "Some Value"
Run Code Online (Sandbox Code Playgroud)
这一切都很好:字符串在generated.xml中正确显示,可以通过getResources().getString(R.id.my_string)应用程序代码访问.
当其中一个字符串包含%符号时,它不起作用.它给出了这个错误:
错误:(1)以非位置格式指定的多个替换; 你的意思是添加formatted ="false"属性?
我从Android XML百分比符号中了解到,对于strings.xml中的字符串资源,通常会解决此问题,方法是提供额外formatted="false"属性,如下所示:
<string formatted="false">My string with a % symbol</string>
Run Code Online (Sandbox Code Playgroud)
在构建脚本中formatted="false"使用生成字符串时如何包含属性resValue?
(我也按照建议尝试使用double-%进行转义,但这会导致%%出现在最终字符串中.)
希望这符合成为一个写得很好的问题的标准.我是编程的新手,我一直在尝试为Android上的登山者编写一个应用程序,根据他们当前培训期间的能力告诉用户他们应该攀爬什么.该应用程序要求用户输入他们的攀爬能力和墙壁长度.
我使用SharedPrefences数字编辑文本字段和列表为此设置了首选项菜单.最初我有一个类强制转换异常,因为我试图使用编辑文本中的字符串作为float/double/int(我尝试了所有三个!).
我已经将字符串转换为double,使用Double = Double.valueof(StringFromPrefernce)
它解决了这个错误,但现在产生了java.util.FormatFlagsConversionMismatchException: %o does not support ' '我无法找到解决方案的错误.
该应用程序允许用户最初访问首选项菜单,但是一旦他们设置了一些值,任何访问首选项菜单的尝试都将产生此强制关闭.
解:
在我的preferences.xml中,我引用了一个字符串.该字符串包含%符号,该符号负责关闭力.删除%符号修复了问题.
我需要使用格式化程序创建一个字符串以在应用程序中显示一些双精度值。我不清楚如何编码。这是我所拥有的:
<string name="diseaseMessage">You have %s message, Unread %s</string>
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
error: Unexpected end tag string strings.xml /TSMS Pro/res/values line 70 Android AAPT Problem
Run Code Online (Sandbox Code Playgroud)