发生问题是因为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:!*~'
}
...
}
希望这会有所帮助:)