Build failed: Gradle build failed with unknown error. Expo Managed Workflow

Hello, I ran into an error while using eas build --platform android. I was able to build an apk using expo build android --type apk but eas fails with an error. Build failed: Gradle build failed with unknown error.
Please help me to identify the exact issue. Thanks.

Note: Some input files use unchecked or unsafe operations.

Note: /build/workingdir/build/node_modules/expo-app-auth/android/src/main/java/expo/modules/appauth/ uses unchecked or unsafe operations.

[stderr] Note: /build/workingdir/build/node_modules/expo-application/android/src/main/java/expo/modules/application/ uses or overrides a deprecated API.

[stderr] `Note: /build/workingdir/build/node_modules/expo-constants/android/src/main/java/expo/modules/constants/ uses or overrides a deprecated API.`

[stderr] Note: /build/workingdir/build/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/ uses or overrides a deprecated API.

Those aren’t the actual errors in your build, if you look at your build logs, it seems like react native firebase is what’s causing issues

Hello, @charliecruzan thanks for replying. Have you come across similar issues with firebase? or is it just my setup. on Expo Go and Expo build android(classic) everything is working well.

It looks like it’s not able to resolve some direct-from-android packages, so most likely has to do with your android project setup

Hey @charliecruzan I did some digging and it appears as more native dependencies are added to a project, it may bump it over the 64k method limit on the Android build system. The firebase in my project might be putting my methods right over the 64k. Also, I found out that this can be potentially solved by Enabling Multidex (to be true).
That being said, is there a way to Enable Multidex in Expo without ejecting to bare workflow?

1 Like

I am sure this is possible to do with a Config Plugin.

The changes listed here are pretty small.

@charliecruzan are there any similar existing config plugins to use as an example for how to do this?

Yeah this could be done with a config plugin for sure- there’s a mod for each of these in the default mods list. As for examples- the expo/expo repo is a great place to search for those mod names (like projectBuildGradle) to find existing plugins for our expo libraries

I suppose you mean expo/config-plugins?

I don’t see one for

I think I need to dig into the expo/config-plugins repo some more to figure this stuff out properly. At the moment I still feel like I’m feeling my way around in the dark.

No, expo/expo contains all our RN libraries and they all have config plugins made for them: expo/packages at master · expo/expo · GitHub

And yeah you’re right- not mainapp…I misread mainactivity in your link as mainapp, sorry about that

Ah OK thanks. Is there something to update Or should one just copy the mods for and modify as needed?

Editing MainApplication is pretty tough I think…and we’re currently trying to make it so that you don’t need to directly edit this file but instead just extend some interface in your MainApplication. However- the expo-dev-client does this now: expo/withDevLauncher.ts at master · expo/expo · GitHub

1 Like