question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project with Expo SDK 44, expo-secure-store 11.1.0+ fails to build on EAS for Android

See original GitHub issue

Summary

I’ve tried using expo-secure-store:11.1.1 (latest version at the time of writing which is installed when doing expo install expo-secure-store) in a managed workflow expo app. When trying to build production Android build on EAS, the build fails with:

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseResources'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[stderr]    > Android resource linking failed
[stderr]      /home/expo/workingdir/build/android/app/build/intermediates/bundle_manifest/release/AndroidManifest.xml:88: AAPT: error: resource style/DeviceCredentialHandlerTheme (aka com.xxx.app:style/DeviceCredentialHandlerTheme) not found.

I get the same error with 11.1.0.

Solution

It builds OK with 11.0.1. iOS build passes successfully in EAS for all tested versions (>=11.0.1). Dev builds work fine with any version.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

44.0.6

Environment

This is not from expo-env-info, this is from EAS since EAS worker is the build environment:

Creating new worker instance
Using image "ubuntu-18.04-jdk-8-ndk-r19c" based on "ubuntu:bionic-20210930"
Installed software:
- NDK 19.2.5345600
- Node.js 16.13.2
- Yarn 1.22.17
- npm 8.1.2
- Java 8
- Expo CLI 5.3.0

Reproducible demo

EAS build ID that fails (maybe useful to Expo devs) is 3b600353-681e-4c94-8ea3-a263082d638b.

Possible culprit is this PR https://github.com/expo/expo/pull/14512

It adds androidx.biometric:biometric:1.1.0 Android dependency which contains changes that are related to DeviceCredentialHandlerTheme.

The Android build error is quite cryptic but some Google search results point out that a change should be done in the Android Manifest, for example: https://github.com/unimodules/react-native-unimodules/issues/176

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ddinchevcommented, May 27, 2022

Here is one solution for a managed app by using a config plugin:

In app.json add the following config plugin:

    "plugins": [
      "./expo-config-plugins/device-credential-handler-theme.js"
    ],

Create ./expo-config-plugins/device-credential-handler-theme.js with the following content:

const { withAndroidStyles } = require("@expo/config-plugins")

/**
 * A workaround for https://github.com/expo/expo/issues/17108
 * On Android expo-secure-storage demands a theme called DeviceCredentialHandlerTheme,
 * but there isn't one. This plugin adds it
 */
module.exports = function deviceCredentialHandlerThemeCreator(config) {
  return withAndroidStyles(config, (config) => {
    const styles = config.modResults.resources.style
    styles.push(
      {
        $: {
          name: "DeviceCredentialHandlerTheme",
          // AppTheme is the default theme name => this makes the new theme the same as the default
          parent: "AppTheme",
        },
        item: [],
      },
    )
    return config
  })
}

Build now passes with expo-secure-plugin:11.2.0.

1reaction
larshanskrausecommented, Apr 29, 2022

@raajnadar I’ve used expo install expo-secure-store as per instructions which installs 11.1.1 for me. And it does not work (causing the error in the issue). I had to manually fix the expo-secure-store version to 11.0.1 in my package.json in order to get to a working build.

Thanks @ddinchev, it worked for us too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I recently updated to expo SDK 44 and now I'm getting ...
EAS build using eas build -p android fails due to a gradle error and it seems to be related to @react-native-async-storage/async-storage and ...
Read more >
Expo project fails to build when using expo-secure-store SDK
My eas build was for android. eas build:configure. Install expo-secure-store and add to config. npx expo install expo-secure-store. app.json
Read more >
a problem occurred evaluating project ':expo' ...
I am trying to build an android app with EAS but it returns me an error with unimodules-permissions-interface. Environment. expo-env-info 1.0.5 environment info ......
Read more >
Expo SDK 38 is now available
On Android, notifications can only be forwarded to one of the two APIs at a time, so you'll need to explicitly opt into...
Read more >
Tweets with replies by Expo (@expo) / ...
Expo Modules API 1.0: JSI & Fabric native modules with an idiomatic Swift ... You also can run “npx expo prebuild” to expose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found