Task ':react-native-agconnect-remoteconfig:verifyReleaseResources' FAILED

I tried to build a release apk but I got this error. I checked the file. It exists!

* What went wrong:
Execution failed for task ':react-native-agconnect-remoteconfig:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource compilation failed
     AAPT: /Users/xxx/com.xxx.xxx/node_modules/@react-native-agconnect/remoteconfig/android/build/intermediates/res/merged/release/layout/abc_alert_dialog_button_bar_material.xml: error: file not found.

What I’ve tried :

Added the following code in android/build.gradle :

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}

How can I solve this problem?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

After adding the code below, make sure that you are using compatible compileSdkVersion & buildToolsVersion :

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}

then

cd android && ./gradlew clean && ./gradlew app:assembleRelease

P.S. ./gradlew assembleRelease does not work but you can build an apk by using Android Studio or the script above

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply