question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Values from strings.xml not found in capacitor AndroidManifest.xml

See original GitHub issue

I’m trying to get my project to compile with the jeduan/cordova-plugin-facebook4 cordova plugin. I have included my facebook id and app name in the app/src/main/res/values/strings.xml like so:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="app_name">UI</string>
    <string name="title_activity_main">UI</string>
    <string name="package_name">[redacted]</string>
    <string name="fileprovider_authority">[redacted]</string>
    <string name="custom_url_scheme">[redacted]</string>
    <string name="fb_app_id">[redacted]</string>
    <string name="fb_app_name">UI</string>
</resources>

I have also added the necessary facebook values to app/src/main/AndroidManifest.xml like so:

...
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
<meta-data android:name="com.facebook.sdk.ApplicationName" android:value="@string/fb_app_name" />
<activity android:name="com.facebook.FacebookActivity"
          android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/fb_app_name" />
...

Despite this fact I am getting this error upon compilation:

dManifest.xml:13: AAPT: error: resource string/fb_app_id (aka capacitor.android.plugins:string/fb_app_id) not found.
    
/Users/nstokoe/code/fullmeasure/prototype/ui/node_modules/@capacitor/cli/assets/capacitor-android-plugins/build/intermediates/manifests/aapt/release/AndroidManifest.xml:16: AAPT: error: resource string/fb_app_name (aka capacitor.android.plugins:string/fb_app_name) not found.
    
/Users/nstokoe/code/fullmeasure/prototype/ui/node_modules/@capacitor/cli/assets/capacitor-android-plugins/build/intermediates/manifests/aapt/release/AndroidManifest.xml:20: AAPT: error: resource string/fb_app_name (aka capacitor.android.plugins:string/fb_app_name) not found.

The file it is complaining about looks like this in my node_modules:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:amazon="http://schemas.amazon.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="capacitor.android.plugins"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="27" />

    <application>
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/fb_app_id" />
        <meta-data
            android:name="com.facebook.sdk.ApplicationName"
            android:value="@string/fb_app_name" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/fb_app_name" />
    </application>

</manifest>

Is there something I am missing to make the values defined in strings.xml available to the manifest files in the capacitor module?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ThonyFDcommented, Jun 1, 2021

For someone facing this issue building release versions:

change assemblerelease for app:assemblerelease

Read this for more info: https://stackoverflow.com/questions/60990805/difference-between-appassemblerelease-and-assemblerelease

2reactions
matheocommented, Jul 8, 2019

For the record, adding the missing fb_app_id and fb_app_name to app/src/main/res/values/strings.xml worked for me, but it’s concerning to not have them added automatically from the plugin config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to copy `string.xml` to capacitor-cordova-android-plugins?
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...
Read more >
Configuring Android | Capacitor Documentation
AndroidManifest.xml may reference additional files such as styles.xml and strings.xml within the android/app/src/main/res/values directory via @style and ...
Read more >
Ionic5 capacitor fix AndroidManifest.xml for missing activity ...
Ok, I found it. I have to change the YouTubeActivity -> android:label="@string/activity_name" for android:label="@string/app_name" for the ...
Read more >
Migrating to Cordova-Android 11 - Ionic
is also present at [:br-android-vault:] AndroidManifest.xml:10:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to ...
Read more >
Config.xml - Apache Cordova
Set the activity name for your app in AndroidManifest.xml. Note that this is only set once after the Android platform is first added....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found