verifyReleaseResources
对于我的android assembleRelease构建一直失败。
我的react-native
版本的说明
System:
OS: macOS 12.6
CPU: (10) x64 Apple M1 Max
Memory: 22.59 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
Yarn: 1.22.18 - ~/github/snackpass/snackpass-client/node_modules/.bin/yarn
npm: 8.19.2 - /opt/homebrew/bin/npm
Watchman: 2022.10.31.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Dolphin 2021.3.1 Patch 1 Dolphin 2021.3.1 Patch 1
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /Users/alitamoore/.jenv/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: ^0.64.4 => 0.64.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
这是我发现的一些错误
(警告/错误)* 找不到参数文件 *
Argfile not found: /Users/alitamoore/Library/Application Support/kotlin/daemon/promotedai_react-native-metrics_release
(错误)* 不兼容的Kotlin版本 *
/Users/alitamoore/.gradle/caches/transforms-3/39d9fb5957939f0b72af860a8de1b4e0/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/556bb75edc66f947ffbea3dd348ad797/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/572b2229271f904a5c21007cf91f4994/transformed/jetified-react-native-0.71.0-rc.0-release-api.jar!/META-INF/ReactAndroid_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/687b7f7119d3db63f03c30ceb978b8e7/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/b89184fd2243c0ba9c21f04aac02ee1a/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
如果我强制Kotlin版本的依赖项为1.6.0,那么我会得到另一个错误(错误)* 链接文件资源失败 *
Execution failed for task ':promotedai_react-native-metrics: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
AAPT: /Users/alitamoore/github/snackpass/snackpass-client/node_modules/@promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:18: error: resource attr/autofillInlineSuggestionChip (aka ai.promoted:attr/autofillInlineSuggestionChip) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/@promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:25: error: resource attr/autofillInlineSuggestionStartIconStyle (aka ai.promoted:attr/autofillInlineSuggestionStartIconStyle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/@promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:32: error: resource attr/autofillInlineSuggestionTitle (aka ai.promoted:attr/autofillInlineSuggestionTitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/@promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:41: error: resource attr/autofillInlineSuggestionSubtitle (aka ai.promoted:attr/autofillInlineSuggestionSubtitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/@promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:50: error: resource attr/autofillInlineSuggestionEndIconStyle (aka ai.promoted:attr/autofillInlineSuggestionEndIconStyle) not found.
error: failed linking file resources.
此错误也是不可预测的,有时在清除缓存后,它会通过构建。
1条答案
按热度按时间aiqt4smr1#
我不知道为什么会发生这种情况,但我知道从android/settings.gradle中删除违规的链接包(注意,链接只适用于RN〈0.69.0)可以修复它。例如,删除这些行(在给出的示例中)
在调试过程中,我还发现了一些有用的解决方案,可以解决上面提到的错误。它们可能很有用:
找不到参数文件
尝试
不兼容的Kotlin版本
如果你注意到上面的错误,它说
The binary version of its metadata is 1.6.0, expected version is 1.1.15
,但1.1.15
不是Kotlin的有效版本。所以如果你用一个有效版本覆盖它,它会修复这个问题。尝试首先在项目范围内应用它(android/build.gradle)如果存在问题,则可以在依赖关系中直接覆盖它,然后使用
patch-package
保存这些更改链接文件资源失败
在某些情况下,您可能会看到
error: resource android:attr/lStar not found
。在这种情况下,请参阅Saurabh’s suggestion或this video。