Errors caused by eas build

When I run eas build --platform android, I get the following error which I am unable to resolve.
I’ve been struggling for 3 days.

・SDK Version:48
・Platforms(Android/iOS/web/all):Android

・Error message
Build failed: Gradle build failed with unknown error. See logs for the “Run gradlew” phase for more information.

・Error log

[stderr] 
FAILURE: Build completed with 2 failures.
[stderr] 
1: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':app:createBundleReleaseJsAndAssets'.
[stderr] 
> Process 'command 'node'' finished with non-zero exit value 1
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
2: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
java.lang.StackOverflowError (no error message)
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 4m 51s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Hi @kenty6

Look further up in the logs for something like:

> Task :app:createBundleReleaseJsAndAssets FAILED

There should be more information about the problem.

Also check the “Run expo doctor” log for any problems there.

Hi @wodin

Thank you for advice.
I went back and looked at the logs and the following error was found.
When I was developing with expo go, I had no problems with the env file and I can import.
Why is this error occurring?
I don’t know how to solve this problem.

・Error log

Task :app:createBundleReleaseJsAndAssets FAILED
SyntaxError: /home/expo/workingdir/build/firebase.js: “FIREBASE_API_KEY” is not defined in .env
4 | import { getFirestore } from “firebase/firestore”;
5 | import {
6 | FIREBASE_API_KEY,
| ^^^^^^^^^^^^^^^^
7 | FIREBASE_AUTH_DOMAIN,
8 | FIREBASE_PROJECT_ID,
9 | FIREBASE_STORAGE_BUCKET,

you can add FIREBASE_API_KEY in expo dev secrets and use it.

Do you have .env in .gitignore?

As @kirtikk mentions you could use EAS Secrets instead of a .env file when building using EAS Build.

See also: Environment variables and secrets

Yes,I have .env in .gitignore.
I was able to solve this problem by using eas secrets as kirtikk mentioned.

Thank you very much, @wodin , @kirtikk

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.