升级React Native后出现“ verifyReleaseResources”错误

时间:2018-10-02 17:04:12

标签: react-native android-gradle react-native-android

我正在尝试将应用程序升级到React Native 0.57.1​​。我想我已经按照所有步骤操作,升级了所有正确的文件,但是仍然出现我无法理解的错误:

: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

我真的无法理解这些错误,知道它们是什么意思吗?我如何找出解决方法?

我尝试了各种操作,包括删除.cache目录,更改gradle版本,但似乎无济于事。有想法吗?

4 个答案:

答案 0 :(得分:32)

您需要在项目的android / build.gradle中添加以下代码:

['France','another','another...']

答案 1 :(得分:3)

对我来说,解决该问题的方法是在 app

开头添加前缀
./gradlew app:assembleRelease

答案 2 :(得分:2)

错误原因:

您已安装 react-native-document-picker 作为依赖项,并且发生此错误的原因是android/app/build.gradlenode_modules/react-native-document-picker/android/build.gradle的配置不匹配。< / p>

解决方案

  1. 导航到node_modules/react-native-document-picker/android/build.gradle
  2. 编辑compileSdkVersion buildToolsVersion minSdkVersion targetSdkVersion并使其与android/app/build.gradle相同
  3. 再次同步项目。
  4. 从终端运行./gradlew assembleRelease

答案 3 :(得分:0)

由于这个问题的另一个原因,我之前修改过minSdkVersion。 您需要做的就是删除/ node_modules /文件夹,/ android / build和/ android / app / build文件夹,重新安装npm并执行./gradlew assembleRelease。