2

AAPT: error: resource android: attr/IStar not found.

This error occurred suddenly, it was working fine last week.

enter image description here

I've tried many solutions but none works. Solutions tried:

  1. Delete, reinstall npm, using npm install
  2. clean gradle with ./gradlew clean in /android
  3. Cleaning npm cache with npm cache clean --force
  4. add org.gradle.jvmargs=-Xmx4608m in /android/gradle.properties
  5. In /android/build.gradle, inside ext{} add androidXCore = "1.6.0"
  6. npm update @react-native-community/netinfo
  7. androidx.core:core-ktx:+ to androidx.core:core-ktx:1.6.0 but I've searched through my project, there is no 'androidx.core:core-ktx:+. So this solution I found is irrelevant.

Version:

"react-native": "0.63.4",

compileSdkVersion = 29
targetSdkVersion = 29
0

2 Answers 2

7

Add this in your android/buld.gradle file.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

Ref : https://github.com/facebook/react-native/issues/35210

Sign up to request clarification or add additional context in comments.

1 Comment

It works! Gosh.. took me lots of hours to finally found a solution that works!. Thank you very much mate!
2

There had been a series of build failures React Native & Expo users have been experiencing when building Android apps starting from November 4th 2022. Your issue is the same.

Since you are using React-native 0.63 React-native has a new patch released for it. try updating your react-native in your package.json from "react-native": "^0.63.4" to "react-native": "^0.63.5" and try running npm install and everything will work fine.

The suggested answer by Thanhal will give you some headaches if you try to upgrade to a new version of react-native and forget to remove it from build.gradle.

for more info please refer to This issue on github

5 Comments

Ahh, thanks for your information and github link, will take note on that and will change later.
@AhChing11 have you got the time to try my suggestion?
So sorry I was rushing on deadlines, I'll try it next week.
I've tried upgrading to 0.63.5. But it returns 2 errors 1. > A problem occurred evaluating script. > Cannot run Project.afterEvaluate(Closure) when the project is already evaluated. 2. A problem occurred configuring project ':app'. > compileSdkVersion is not specified. Please add it to build.gradle
Have you undo the changes on android/build.gradle before upgrading

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.