首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android verifyReleaseResources失败,资源未找到

Android verifyReleaseResources失败,资源未找到
EN

Stack Overflow用户
提问于 2022-11-10 00:23:20
回答 1查看 133关注 0票数 1

verifyReleaseResources在我的android assembleRelease构建上一直失败。

对我的react-native构建的描述

代码语言:javascript
复制
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未找到

代码语言:javascript
复制
Argfile not found: /Users/alitamoore/Library/Application Support/kotlin/daemon/promotedai_react-native-metrics_release

(错误)不兼容的kotlin版本

代码语言:javascript
复制
/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,那么我会得到另一个错误(错误)--链接文件资源失败

代码语言:javascript
复制
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.

这个错误也是不可预测的,有时在清除缓存之后它会通过构建。

EN

回答 1

Stack Overflow用户

发布于 2022-11-10 00:23:20

我不知道为什么会发生这种事。但我确实知道,从android/setings.gradle中删除违规链接包(注意,链接只应用RN < 0.69.0)可以修复它。例如删除这些行(在给出的示例中)

代码语言:javascript
复制
include ':@promotedai_react-native-metrics'
project(':@promotedai_react-native-metrics').projectDir = new File(rootProject.projectDir, '../node_modules/@promotedai/react-native-metrics/android')

在调试时,我还找到了一些解决提到的错误的有用的解决方案。它们可能有用:

Argfile未找到

试一试

代码语言:javascript
复制
cd android
./gradlew clean

不兼容Kotlin版本

如果您注意到上面的错误,上面写着The binary version of its metadata is 1.6.0, expected version is 1.1.15,但是1.1.15不是Kotlin的有效版本。因此,如果您用一个有效的版本覆盖它,它将修复这个问题。试着先把它应用到wide项目(android/build.gradle)

代码语言:javascript
复制
buildScript {
  ext {
    kotlinVersion = “1.6.0”
  }
}

如果存在问题,则可以在依赖项中直接覆盖它,然后使用patch-package保存这些更改。

链接文件资源失败

在某些情况下,您可能会看到error: resource android:attr/lStar not found。在这种情况下,请参阅我发现有用的索拉布的建议这段视频

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74382831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档