DEV Community

Nour Abdou
Nour Abdou

Posted on

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 😌

Top comments (1)

Collapse
 
thanhdevapp profile image
thanhdevapp

Thanks, it's worked