Frank Andrew
Frank Andrew

Reputation: 917

React Native Build Error Execution failed for task ':react-native-get-sms-android:verifyReleaseResources'

I get a problem to build react native after install 'react-native-get-sms-android', you can find here https://www.npmjs.com/package/react-native-get-sms-android, I don't know why, I try to look for similar error but fail all.

This is the complete error :

> Task :app:processReleaseGoogleServices
Parsing json file: D:\Project\React Native\myProject\android\app\google-services.json

error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.

C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/font not found.

C:\Users\frank\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\226ef6010c3c969192062affc53f6ce6\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.

error: failed linking references.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-get-sms-android:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 54s
203 actionable tasks: 4 executed, 199 up-to-date

Please anyone help me to solve this problem.

Thanks.

Upvotes: 2

Views: 3380

Answers (2)

Hadi Mir
Hadi Mir

Reputation: 5133

Reason for the error:

You have installed react-native-get-sms-android as a dependency, And the reason for this error is that the configurations of your android/app/build.gradle and node_modules/react-native-get-sms-android/android/build.gradle mismatch.

Solution

  1. Navigate to node_modules/react-native-get-sms-android/android/build.gradle
  2. Edit and keep the compileSdkVersion buildToolsVersion minSdkVersion targetSdkVersion same as you have in android/app/build.gradle
  3. Sync the project again.
  4. Run ./gradlew assembleRelease from the terminal.

Upvotes: 6

nikos fotiadis
nikos fotiadis

Reputation: 1085

You need to update your android build tools version. The following worked for me. In android/build.gradle change ext to look like this:

ext {
    buildToolsVersion = "28.0.0"
    minSdkVersion = ... // your min SDK
    compileSdkVersion = 28
    targetSdkVersion = ...// your target SDK
    supportLibVersion = "28.0.0"
}

and put this at the end of your file:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "28.0.0"
            }
        }
    }
    afterEvaluate {
        project -> if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '28.0.0'
            }
        }
    }
}

In android/app/build.gradle change this: "com.android.support:appcompat-v7:27.1.1" to this: "com.android.support:appcompat-v7:28.0.0"

Upvotes: 6

Related Questions