paystack-android: AAPT: error: resource attr/foreground (aka com.package.appname:attr/foreground) not found.

Problem

Unable to compile App after adding Paystack dependecies

Proposed resolution

Unable to compile application after adding Paystack dependencies, i have also added the below code to my attrs file under values folder

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="ForegroundView">
        <attr name="foreground" format="color" />
        <attr name="foregroundGravity" format="integer" />
        <attr name="foregroundInsidePadding" format="boolean" />
    </declare-styleable>
</resources>

Repeatable

Always

Paystack version

implementation 'co.paystack.android.design.widget:pinpad:1.0.1'
implementation 'co.paystack.android:paystack:3.0.12'

App default configuration

defaultConfig {
        applicationId "com.eemanapp.fuoexaet"
        minSdkVersion 19
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Actual Results:

/Users/mac/AndroidStudioProjects/AppName/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:4751: AAPT: error: resource attr/foreground (aka com.packageName.appName/foreground) not found.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I was using Android Studio 3.6 Beta, it worked well when I switched back to 3.5 Stable

I’m faced with this same issue after I installed Paystack SDK for RN

Do as @michael-paystack has mentioned up there. Decrease the Android Gradle Plugin to 3.5.x version. Do this in the project’s build.gradle file. That solved it for me.

Yea I tried that approach but it didn’t work for me. But i have been able to resolve it as stated in this tread below:

https://stackoverflow.com/questions/56715285/how-to-fix-aapt-error-foreground-activity-not-found-when-running-ionic-cordova-b

And also I didn’t want to downgrade my Gradle build version to avoid affecting other aspect of the project.

Facing this same exact problem since this morning. Running on Android studio 3.6 and it’s frustrating

Problem

Unable to compile App after adding Paystack dependecies

Proposed resolution

Unable to compile application after adding Paystack dependencies, i have also added the below code to my attrs file under values folder

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="ForegroundView">
        <attr name="foreground" format="color" />
        <attr name="foregroundGravity" format="integer" />
        <attr name="foregroundInsidePadding" format="boolean" />
    </declare-styleable>
</resources>

Repeatable

Always

Paystack version

implementation 'co.paystack.android.design.widget:pinpad:1.0.1'
implementation 'co.paystack.android:paystack:3.0.12'

App default configuration

defaultConfig {
        applicationId "com.eemanapp.fuoexaet"
        minSdkVersion 19
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

Actual Results:

/Users/mac/AndroidStudioProjects/AppName/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:4751: AAPT: error: resource attr/foreground (aka com.packageName.appName/foreground) not found.

Try changing your gradle plugin to stable version (3.5.1)