出现此问题是因为 AAPT(Android 资产打包工具)找不到某些资源。修复此问题如下:
1.将必要的资源复制到新的响应资源文件夹中,命名为 res_fw_v7_preference 或其他名称。
2.使用 gradle 构建您的应用程序并在 build.gradle(module's) 中添加一些额外的 AAPT 选项,如下所示:
android {
...
aaptOptions {
additionalParameters '-S',
'src/main/res_fw_v17_leanback', // resources in frameworks/support/v17/leanback
'-S',
'src/main/res_fw_v7_preference', // resources in frameworks/support/v7/preference
'-S',
'src/main/res_fw_v14_preference', // resources in frameworks/support/v14/preference
'-S',
'src/main/res_fw_v17_preference-leanback', // resources in frameworks/support/v17/preference-leanback
'-S',
'src/main/res_fw_v7_appcompat', // resources in frameworks/support/v7/appcompat
'-S',
'src/main/res_fw_v7_recyclerview', // resources in frameworks/support/v7/recyclerview
'-S',
'src/main/res', // resources in your application
'--auto-add-overlay',
'--extra-packages',
'android.support.v17.leanback:android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview'
noCompress 'foo', 'bar'
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
...
}
希望这会有所帮助:)