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.

Android resource linking failed when using a plugin that uses value lookup from xml

See original GitHub issue

Description of the problem: When building for android with capacitor-FCM plugin I get:

> Task :capacitor-fcm:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-fcm:verifyReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  /Users/michael/Repos/covve.XPApp-Capacitor/node_modules/capacitor-fcm/android/capacitor-fcm/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  /Users/michael/Repos/covve.XPApp-Capacitor/node_modules/capacitor-fcm/android/capacitor-fcm/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  /Users/michael/Repos/covve.XPApp-Capacitor/node_modules/capacitor-fcm/android/capacitor-fcm/build/intermediates/res/merged/release/values/values.xml:3864: error: resource android:attr/fontVariationSettings not found.
  /Users/michael/Repos/covve.XPApp-Capacitor/node_modules/capacitor-fcm/android/capacitor-fcm/build/intermediates/res/merged/release/values/values.xml:3865: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

Removing the plugin makes the error go away.

Adding plugin cordova-plugin-facebook4 and building produces a similar error:

> Task :capacitor-cordova-android-plugins:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-cordova-android-plugins:verifyReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  warn: removing resource capacitor.android.plugins:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.
  /Users/michael/Repos/covve.XPApp-Capacitor/android/capacitor-cordova-android-plugins/build/intermediates/aapt_friendly_merged_manifests/release/aapt/AndroidManifest.xml:54: error: resource string/fb_app_id (aka capacitor.android.plugins:string/fb_app_id) not found.
  /Users/michael/Repos/covve.XPApp-Capacitor/android/capacitor-cordova-android-plugins/build/intermediates/aapt_friendly_merged_manifests/release/aapt/AndroidManifest.xml:57: error: resource string/fb_app_name (aka capacitor.android.plugins:string/fb_app_name) not found.
  /Users/michael/Repos/covve.XPApp-Capacitor/android/capacitor-cordova-android-plugins/build/intermediates/aapt_friendly_merged_manifests/release/aapt/AndroidManifest.xml:61: error: resource string/fb_app_name (aka capacitor.android.plugins:string/fb_app_name) not found.
  error: failed processing manifest.

But strings.xml has the required values that the build nags about:

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">xxx</string>
    <string name="title_activity_main">xxx</string>
    <string name="package_name">xxx</string>
    <string name="fileprovider_authority">xxx</string>
    <string name="custom_url_scheme">xxx</string>
    <string name="fb_app_id">xxx</string>
    <string name="fb_app_name">xxx</string>
</resources>

This happens consistently when doing a command line build with gradlew. Building with Android Studio this error comes up like 3 times out of 10. Some builds are successful. On another machine this error happens 10/10 in android studio.

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information:

Capacitor version: 1.1.1 node version: 10.15.3 npm version: 6.9.2 CocoaPods version:

Steps to reproduce:

Link to sample project:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, Jul 22, 2019

Supposedly if you add the exact same dependency with the version you want to use to the app’s build.gradle it will use that version, but sometimes fails for some strange reason (I blame gradle).

You can also force the gradle version for all modules/plugins by adding this to the project’s build.gradle (not the app one, the project one)

project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && details.requested.name != 'multidex'
                    && details.requested.name != 'multidex-instrumentation') {
                details.useVersion 28.0.0
            }
        }
    }

We also plan to add gradle variables so it’s easier to set common versions, but once we do, plugins should also need to be updated to use those variables instead of fixed versions.

0reactions
masimplocommented, Jul 22, 2019

Oh so I have to match the SDK of the plugins even though I am defining a greater support library as an app dependency. Can I use that lowest or does it have to be the same? Because if it has to be the same, then we need to keep all plugins in sync, which can turn into a real problem. I will go ahead and try setting my app SDK version to 27 and see what happens. Thanks for the input, I appreciate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android resource linking failed in the build - Stack Overflow
Im using android studio for the build process. The generated android manifest.xml file is giving me some android resource linking errors. To be ......
Read more >
Known issues with Android Studio and Android Gradle Plugin
Find out about current known issues with Android Studio and the Android Gradle Plugin.
Read more >
Android resource linking failed error in android studio - YouTube
In this video i solve a major but most common error of android studio watch it and comment down below if you face...
Read more >
Constraint layout using non-explicit attr definitions in 2.0.0 ...
AGPBI: {"kind":"error","text":"Android resource linking failed" ... \\merged.dir\\values\\values.xml:6398: AAPT: error: resource attr/motionProgress (aka ...
Read more >
Gradle Build Failed. Android resource linking failed.
0.aar\0f6db07822cfb7aac28f98d6185ee4d4\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/ ...
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