React-Native-Paystack-WebView
React-Native-Paystack-WebView copied to clipboard
AAPT: error: resource attr/foreground
Describe the bug
Task :react-native-paystack:verifyReleaseResources FAILED I suddenly started getting this error when i try to build the application from terminal. The application works well when testing on emulator and device with no error
AAPT: error: resource attr/foreground (aka com.arttitude360.reactnative.rnpaystack:attr/foreground) not found.
AAPT: error: resource attr/foregroundInsidePadding (aka com.arttitude360.reactnative.rnpaystack:attr/foregroundInsidePadding) not found.
AAPT: error: resource attr/foregroundGravity (aka com.arttitude360.reactnative.rnpaystack:attr/foregroundGravity) not found.
To Reproduce Steps to reproduce the behavior:
- Go to terminal and run the command from the android dir ./gradlew assembleRelease -x bundleReleaseJsAndAssets
- Error shows up
Expected behavior Build the app and output an .aab file
Screenshots
Find screenshot of my terminal output below
How i tried resolving the issue
Create an attrs.xml file in the values directory (/android/app/src/res/values/attr.xml) and added content
<declare-styleable name="ForegroundView">
<attr name="foreground" format="color" />
<attr name="foregroundGravity" format="integer" />
<attr name="foregroundInsidePadding" format="boolean" />
</declare-styleable>
Also changed my gradlew version from gradle-6.2 to gradle-6.1.1 and i got the same error
Additional context react-native-paystack-webview:4.0.3 react-native-cli: 2.0.1 react-native: 0.59.8 node: v14.17.0
Kindly let me know whats causing the error as have been stock here for weeks. Regards
Describe the bug
Task :react-native-paystack:verifyReleaseResources FAILED I suddenly started getting this error when i try to build the application from terminal. The application works well when testing on emulator and device with no error
AAPT: error: resource attr/foreground (aka com.arttitude360.reactnative.rnpaystack:attr/foreground) not found. AAPT: error: resource attr/foregroundInsidePadding (aka com.arttitude360.reactnative.rnpaystack:attr/foregroundInsidePadding) not found. AAPT: error: resource attr/foregroundGravity (aka com.arttitude360.reactnative.rnpaystack:attr/foregroundGravity) not found.
To Reproduce Steps to reproduce the behavior:
- Go to terminal and run the command from the android dir ./gradlew assembleRelease -x bundleReleaseJsAndAssets
- Error shows up
Expected behavior Build the app and output an .aab file
Screenshots Find screenshot of my terminal output below
How i tried resolving the issue
Create an attrs.xml file in the values directory (/android/app/src/res/values/attr.xml) and added content
<declare-styleable name="ForegroundView"> <attr name="foreground" format="color" /> <attr name="foregroundGravity" format="integer" /> <attr name="foregroundInsidePadding" format="boolean" /> </declare-styleable>
Also changed my gradlew version from gradle-6.2 to gradle-6.1.1 and i got the same error
Additional context react-native-paystack-webview:4.0.3 react-native-cli: 2.0.1 react-native: 0.59.8 node: v14.17.0
Kindly let me know whats causing the error as have been stock here for weeks. Regards
I was able to solve this in a very interesting way.
After many back and forth, the only solution that worked for me was to
- upgrade my gradlew plugin to 4.2.0 (android/build.gradle) i.e classpath 'com.android.tools.build:gradle:4.2.0'
- upgrade my gradlew distributionUrl version to 7.0 (android/gradle/wrapper/gradle-wrapper.properties) i.e https://services.gradle.org/distributions/gradle-7.0-all.zip
After this gradlew related upgrade, all AAPT: error: resource attr error disapeared.
THIS LEAD ME TO ANOTHER ERROR WHICH TOOK ME DAYS TO RESOLVE AS WELL
Just incase after you reolved the AAPT related error and you hit this next break wall.
'app:lintVitalRelease' error when generating signed app
Did a lot of try and error because the error message after the app:lintVitalRelease error ready the following below.
> Failed to list versions for com.google.firebase:firebase-messaging.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/firebase/firebase-messaging/maven-metadata.xml.
At the end of the day, i got a solution from the following StackOverflow Link
I had this problem and solved it by adding:
lintOptions {
checkReleaseBuilds false
}
to my build.gradle file within the android{ } section.
I hope this saves a persons time and life in general.