我是开发新手,在我正在处理的代码中,现在R.java不会生成。我没有在任何地方导入android.R,自动构建打开,我已经尝试过多次清理项目。我读到任何XML文件中的任何错误都会导致R生成而我只有一个并且它说“前缀”xliff“for element”xliff:g“没有绑定”这里是cade的部分,其中是。错误发生在第22行,它首先说“xliff”,但第28行没有,它有相同的内容:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string name="app_name">Alarm Clock</string>
<string name="app_label">Alarm Clock</string>
<string name="add_alarm">Add alarm</string>
<string name="delete_alarm">Delete Alarm</string>
<string name="enable_alarm">Enable alarm</string>
<string name="disable_alarm">Disable Alarm</string>
<string name="delete_alarm_confirm">This alarm will be deleted.</string>
<string name="show_clock">Show Clock</string>
<string name="hide_clock">Hide clock</string>
<string name="label">Label</string>
<string name="default_label">Alarm</string>
<string name="set_alarm">Set alarm</string>
<string name="alarm_vibrate">Vibrate</string>
<string name="alarm_repeat">Repeat</string>
<string name="alert">Ringtone</string>
<string name="time">Time</string>
<string name="alarm_alert_dismiss_text">Dismiss</string>
<string name="alarm_alert_alert_silenced">
Alarm silenced after
<xliff:g id="minutes">%d</xliff:g>
minutes
</string>
<string name="alarm_alert_snooze_text">Snooze</string>
<string name="alarm_alert_snooze_set">
Snoozing for
<xliff:g id="minutes">%d</xliff:g>
minutes.
</string>
答案 0 :(得分:22)
认为您需要在开始标记中声明名称空间...
AFAICT ,您需要更改
<resources xmlns:android="http://schemas.android.com/apk/res/android">
到
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">