1

verifyReleaseResources keeps failing for my android assembleRelease build.

A description of my react-native build

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 

Here’re some sample errors I got

(Warning/Error) Argfile not found

Argfile not found: /Users/alitamoore/Library/Application Support/kotlin/daemon/promotedai_react-native-metrics_release 

(error) Incompatible kotlin version

/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. 

If I force the kotlin version the dependency to 1.6.0 then I get another error (Error) failed linking file resources

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. 

This error is also unpredictable, sometimes after clearing cache it passes the build.

1

1 Answer 1

2

I don’t know why this happens, exactly. But I do know that removing the offending linked packages (note that links only apply RN < 0.69.0) from android/settings.gradle fixes it. e.g. remove these lines (in the example given)

include ':@promotedai_react-native-metrics' project(':@promotedai_react-native-metrics').projectDir = new File(rootProject.projectDir, '../node_modules/@promotedai/react-native-metrics/android') 

While I was debugging this, I also found some useful solutions to the errors mentioned. They may be useful:

Argfile not found

Try

cd android ./gradlew clean 

Incompatible Kotlin Version

If you notice in the above errors it says The binary version of its metadata is 1.6.0, expected version is 1.1.15 but 1.1.15 is not a valid version of Kotlin. So if you override that with a valid version it’ll fix the issue. Try applying it project wide first (android/build.gradle)

buildScript { ext { kotlinVersion = “1.6.0” } } 

If that has issues, then you can override it directly in the dependency and then save those changes with patch-package

failed linking file resources

In some cases you may see error: resource android:attr/lStar not found. In that case, see Saurabh’s suggestion or this video I found useful.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.