geisi93
geisi93

Reputation: 31

Cannot use strings of resource file in Cordova Android Plugin

I have created a custom plugin for cordova android and I want to use a resource-file. Therefore I have added the following tag to the plugin <resource-file src="src/android/res/values/strings.xml" target="res/values/strings.xml" />

However, this will lead to the following error when building for 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

The build is succesful when I remove the resource-file tag from plugin.xml. Nevertheless, I need those strings.

Does anyone know any solution or alternative to fix this problem? I found a similar problem here, unfortunately without any solution documented:

phonegap build android; not able to build

Thanks.

Upvotes: 2

Views: 2262

Answers (1)

Igor
Igor

Reputation: 51

Have you tried setting strings in your plugin.xml like this:

<config-file target="res/values/strings.xml" parent="/*">
    <string name="mystringname">MyStringValue</string>
</config-file>

Upvotes: 5

Related Questions