DEV Community

Nour Abdou
Nour Abdou

Posted on

4

Solution of Android resource linking failed in React Native

ERROR

Android resource linking failed error raises by some forms like:

  • AAPT: error: resource android:attr/lStar not found
  • error: method does not override or implement a method from a supertype @Override
  • AAPT: error: resource android:attr/lStar not found.

EXPLANATION

It often raises due to transitive dependencies for old RN projects.

However, upgrading react-native version is broken. because each installed package with npm or it's dependencies could be using newer version of react-native or even the latest one.
(check this 'com.facebook.react:react-native:+' in android/app/build.gradle)
So, endless problems can bomb when you try to change packages to your current RN version.

Any way, upgrading existing projects is expensive Dude! 😌

SOLUTION

Don't change versions...
Add the following block to the end of android/build.gradle file

subprojects {
    configurations.all {
        resolutionStrategy {
            force 'com.facebook.react:react-native:${YOUR_RN_VERSION}'
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

And that's it! 😃

Happy Coding 😍
Happy Buildin 😌

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
thanhdevapp profile image
thanhdevapp

Thanks, it's worked

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay