我已经为 cordova android 创建了一个自定义插件,我想使用资源文件。因此我在插件中添加了以下标签
<resource-file src="src/android/res/values/strings.xml" target="res/values/strings.xml" />
但是,这会导致在为 android 构建时出现以下错误:
TypeError: Cannot set property 'text' of null at android_parser.update_from_config (C:\Users\Matthias\AppData\Roaming\npm\ node_modules\cordova\node_modules\cordova-lib\src\cordova\metadata\android_parse r.js:209:51) ERROR running one or more of the platforms: TypeError: Cannot set property 'text' of null
当我从 plugin.xml 中删除资源文件标记时,构建成功。尽管如此,我需要这些字符串。
有人知道解决此问题的任何解决方案或替代方案吗?我在这里发现了类似的问题,不幸的是没有记录任何解决方案:
phonegap build android; not able to build
谢谢。
最佳答案
您是否尝试过在您的plugin.xml中设置字符串,如下所示:
<config-file target="res/values/strings.xml" parent="/*">
<string name="mystringname">MyStringValue</string>
</config-file>
关于android - 无法在 Cordova Android 插件中使用资源文件的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36413819/