expo icon indicating copy to clipboard operation
expo copied to clipboard

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

Open ddinchev opened this issue 4 years ago • 10 comments

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

ddinchev avatar Apr 18 '22 19:04 ddinchev

Use expo install expo-secure-store to install the supported version if you strictly follow expo SDK. Maybe this won't be a limitation with bare workflow, as you are using managed I think this would be an issue.

raajnadar avatar Apr 19 '22 06:04 raajnadar

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

ddinchev avatar Apr 19 '22 07:04 ddinchev

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

larshanskrause avatar Apr 29 '22 15:04 larshanskrause

This same error was mentioned in Discord too, but unrelated to expo-secure-store https://discord.com/channels/695411232856997968/809586753719238656/913366506887315476

chancesmith avatar May 02 '22 21:05 chancesmith

Now with expo 45.0.0 expo-secure-store:11.0.2 no longer builds and expo-secure-store:11.2.0 fails with the same error as the reported in the issue.

ddinchev avatar May 27 '22 09:05 ddinchev

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.

ddinchev avatar May 27 '22 12:05 ddinchev

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

expo-bot avatar Jun 22 '22 15:06 expo-bot

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Sep 20 '22 16:09 github-actions[bot]

If the issue is accepted, is it still closed due to lack of activity?

ddinchev avatar Sep 21 '22 07:09 ddinchev

The bot is closing for stale as there is no activity for a long time.

Some day SDK 44 will be removed from the core you will upgrade to the latest, it is most likely it will be solved in the newer version, did you try the new version?

raajnadar avatar Sep 21 '22 10:09 raajnadar

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Dec 20 '22 11:12 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Dec 27 '22 11:12 github-actions[bot]