Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "verifyReleaseResources" error after upgrading React Native

I'm trying to upgrade an application to React Native 0.57.1. I think I've followed all the steps, upgraded all the right files, yet I'm still getting an error that I cannot understand:

:react-native-document-picker:compileReleaseSources UP-TO-DATE
:react-native-document-picker:mergeReleaseResources UP-TO-DATE
:react-native-document-picker:verifyReleaseResourcesC:\Users\USERNAME\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\b3b5480809d523e6f8b8de92faafbcda\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

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

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

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

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

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


error: failed linking references.
:react-native-document-picker:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

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

I can't really make sense of these errors, any idea what they mean? How can I find out how to fix this?

I've tried various things, including deleting the .cache directory, changing the gradle version but nothing seems to help. Any idea?

like image 574
laurent Avatar asked Oct 02 '18 17:10

laurent


3 Answers

You need to add following code in your project's android/build.gradle:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion "27.0.2"
            }
        }
    }
}
like image 130
Sandy..... Avatar answered Nov 14 '22 21:11

Sandy.....


For me, what fixed the issue was prefixing with app

./gradlew app:assembleRelease
like image 41
Gilad M Avatar answered Nov 14 '22 21:11

Gilad M


Reason for the error:

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

Solution

  1. Navigate to node_modules/react-native-document-picker/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.
like image 10
Hadi Mir Avatar answered Nov 14 '22 23:11

Hadi Mir