简体   繁体   English

无法在反应原生 android 中构建发布版本

[英]Not able to build the release build in react native android

Task:react-native-device-information:verifyReleaseResources FAILED任务:react-native-device-information:verifyReleaseResources FAILED

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Execution failed for task ':react-native-device-information:verifyReleaseResources'.出了什么问题:任务':react-native-device-information:verifyReleaseResources'执行失败。

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade 1 exception was raised by workers: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed C:\Users\navee.gradle\caches\transforms-2\files-2.1\bad4888d8074cc6f9c866f449fedf067\appcompat-1.0.2\res\values-v26\values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError not found. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade 1 exception was raised by workers: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed C:\Users\navee. gradle\caches\transforms-2\files-2.1\bad4888d8074cc6f9c866f449fedf067\appcompat-1.0.2\res\values-v26\values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError未找到。

You have values for compileSdkVersion which are clashing in your MY_PROJECT_NAME/build.gradle file.您的compileSdkVersion值在您的MY_PROJECT_NAME/build.gradle文件中发生冲突。

The first value you have looks something like this:您拥有的第一个值如下所示:

android {

    compileSdkVersion 27

and further down you have some dependencies which are using/need a HIGHER compileSdkVersion value.再往下,您有一些依赖项正在使用/需要更高的compileSdkVersion值。

SOLUTION: Try using the newest SDK, 29 as of this answer.解决方案:尝试使用最新的 SDK,截至本答案 29。 Edit your project/build.gradle (although instead of project you will have a folder named for your specific React Native project/app).编辑你的project project/build.gradle (虽然你将有一个为你的特定 React Native 项目/应用程序命名的文件夹而不是项目)。

android {
    compileSdkVersion 29

    defaultConfig {
        targetSdkVersion 29
    }
    ...
}

I got this information here: https://developer.android.com/about/versions/10/setup-sdk#update-build我在这里得到了这个信息: https://developer.android.com/about/versions/10/setup-sdk#update-build

Explanation: If some package/dependency you're using needs to be able to use certain android APIs that are only available in SDK 29+ but your project/build.gradle is saying "use SDK 27", your dependencies would be expecting to use APIs which wouldn't exist.说明:如果您使用的某些软件包/依赖性需要能够使用某些android API仅在ZF20E3C5E54C0AB3D375D375D375D6660B3F896F896F6Z 29+ build 36+ your project/build.gradle中仅可用。不存在的 API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM