just1and0 / React-Native-Paystack-WebView

💸💳The package allows you accept payment using paystack and guess what, it doesn't require linking! just install and begin to use 🚀
https://paystack.com
MIT License
156 stars 101 forks source link

AAPT: error: resource attr/foreground #104

Open okechukwu0127 opened 2 years ago

okechukwu0127 commented 2 years ago

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:

  1. Go to terminal and run the command from the android dir ./gradlew assembleRelease -x bundleReleaseJsAndAssets
  2. Error shows up

Expected behavior Build the app and output an .aab file

Screenshots Find screenshot of my terminal output below

image

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

okechukwu0127 commented 2 years ago

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:

  1. Go to terminal and run the command from the android dir ./gradlew assembleRelease -x bundleReleaseJsAndAssets
  2. Error shows up

Expected behavior Build the app and output an .aab file

Screenshots Find screenshot of my terminal output below image

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

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

ANSWER


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.