androidreact-nativehuawei-mobile-servicesappgallery-connect

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?


Solution

  • 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