How to copy `string.xml` to capacitor-cordova-android-plugins?

Hi,
I set some variable string needed for my cordva library in my android project string.xml,
but error comes in gradle task :capacitor-android:verifyReleaseResources, cannot finding the variable.
Because of this error I cannot build with AppFlow. (Just running locally with Android Studio is working.)

For exmaple, the name of the variable needed called KAKAO_APP_KEY.
After cap sync android, in capacitor-cordova-android-plugins's AndroidManifest.xml, there is the code:

<meta-data android:name="com.kakao.sdk.AppKey" android:value="@string/kakao_app_key"/>

and in the app folder’s string.xml, there is kakao_app_key:

<string name="kakao_app_key">foo</string>

But because there is NO strings.xml in capacitor-cordova-android-plugins folder, there is error.
So I want to copy strings.xml file to capacitor-cordova-android-plugins folder with cap sync android.

Please let me give some idea how to do this.

Thank you.

Hello,

I’m running into a similar issue. Did you manage to solve it?

Hello,

I found a solution for similar case to this on this post:

I Solved this problem with these steps:

  1. In the app proejct (app/src/main/res/values), create a new xml files for string resource and define the string variables pass to the cordova plugin (or maybe you can just use string.xml)
<?xml version='1.0' encoding='utf-8'?>
<resources>
  <string name="kakao_app_key">foo</string>
</resources>
  1. In the app’s AndroidManifest.xml (app/src/main/AndroidManifest.xml) add variables as meta-data for the variables of the plugin project(in the following, com.kakao.sdk.AppKey). You can find the same variable defined in capacitor-cordova-android-plugins's AndroidManifest.xml. (in the Project explorer, you can find it capacitor-cordova-android-plugins/src/main/AndroidManifest.xml).

app/src/main/AndroidManifest.xml

...
        <meta-data android:name="com.kakao.sdk.AppKey" android:value="@string/kakao_app_key" />
...

capacitor-cordova-android-plugins/src/main/AndroidManifest.xml

...
<application >
    <meta-data android:name="com.kakao.sdk.AppKey" android:value="@string/kakao_app_key"/>
</application>
...

It has been several months, it might lose something, but the main concept was like this. I hope it will help.

I solved using Capacitor-cli hooks,

package.json

scripts: {
   ...
   "capacitor:update:after": "cp android/app/src/main/res/values/strings.xml android/capacitor-cordova-android-plugins/src/main/res/values/strings.xml",
   "capacitor:sync:after": "cp android/app/src/main/res/values/strings.xml android/capacitor-cordova-android-plugins/src/main/res/values/strings.xml"
  
}

this copy the strings.xml file to the capacitor-cordova-android-plugins folder