Cannot build android with eas

  • managed workflow
  • 3.12.0
Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android
2

Downloading https://services.gradle.org/distributions/gradle-8.0.1-all.zip
3
10%.
4
20%.
5
30%.
6
40%.
7
50%.
8
60%
9
70%.
10
80%
11
90%
12
100%
13
Welcome to Gradle 8.0.1!
14
Here are the highlights of this release:
15
- Improvements to the Kotlin DSL 
16
 - Fine-grained parallelism from the first build with configuration cache 
17
 - Configurable Gradle user home cache cleanup 
18
For more details see https://docs.gradle.org/8.0.1/release-notes.html 
19
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.0.1/userguide/gradle_daemon.html#sec:disabling_the_daemon. 
20
Daemon will be stopped at the end of the build 
21
> Task :expo-updates-gradle-plugin:pluginDescriptors 
22
> Task :expo-updates-gradle-plugin:processResources 
23
> Task :expo-dev-launcher-gradle-plugin:pluginDescriptors 
24
> Task :expo-dev-launcher-gradle-plugin:processResources 
25
> Task :gradle-plugin:pluginDescriptors 
26
> Task :gradle-plugin:processResources 
27
> Task :expo-dev-launcher-gradle-plugin:compileKotlin 
28
> Task :expo-dev-launcher-gradle-plugin:compileJava NO-SOURCE 
29
> Task :expo-dev-launcher-gradle-plugin:classes 
30
> Task :expo-dev-launcher-gradle-plugin:jar 
31
> Task :expo-dev-launcher-gradle-plugin:inspectClassesForKotlinIC 
32
> Task :gradle-plugin:compileKotlin 
33
> Task :gradle-plugin:compileJava NO-SOURCE 
34
> Task :gradle-plugin:classes 
35
> Task :gradle-plugin:jar 
36
> Task :gradle-plugin:inspectClassesForKotlinIC 
37
> Task :expo-updates-gradle-plugin:compileKotlin 
38
> Task :expo-updates-gradle-plugin:compileJava NO-SOURCE 
39
> Task :expo-updates-gradle-plugin:classes 
40
> Task :expo-updates-gradle-plugin:jar 
41
> Task :expo-updates-gradle-plugin:inspectClassesForKotlinIC 
42
> Configure project :app 
43
 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@2.4.10) 
44
 ℹ️  Applying gradle plugin 'expo-updates-gradle-plugin' (expo-updates@0.18.12) 
45

[stderr]
FAILURE: Build failed with an exception. 
46

[stderr]
* Where: 
47

[stderr]
Build file '/home/expo/workingdir/build/android/app/build.gradle' line: 183 
48

[stderr]
* What went wrong: 
49

[stderr]
A problem occurred evaluating project ':app'. 
50

[stderr]
> Cannot invoke method android() on null object 
51

[stderr]
* Try: 
52

[stderr]
> Run with --stacktrace option to get the stack trace. 
53

[stderr]
> Run with --info or --debug option to get more log output. 
54

[stderr]
> Run with --scan to get full insights. 
55

[stderr]
* Get more help at https://help.gradle.org 
56

[stderr]
BUILD FAILED in 2m 5s 
57
15 actionable tasks: 15 executed 
58
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information. ```

eas.json

 {
  "cli": {
    "version": ">= 3.12.0",
    "appVersionSource": "remote"
  },
  "build": {
    "development": {
      "channel": "development",
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    },
    "preview": {
      "channel": "preview",
      "distribution": "internal",
      "resourceClass": "medium",
      "ios": {
        "image": "latest"
      }
    },
    "production": {
      "channel": "production",
      "autoIncrement": true
    }
  },
  "submit": {
    "production": {
      "android": {
        "track": "internal",
        "serviceAccountKeyPath": "./service-account-v02.json"
      }
    }
  }
}

i am having the same problem. I need urgent solution. !!!

Same here. I am getting closer to getting it working (I think).

You could try this. Find your “platform-tools” location, it should be somewhere like this in your AppData, then do this in your command prompt with the location:

set PATH=%PATH%;C:\Users\steve\AppData\Local\Android\Sdk\platform-tools

That will set a temporary path. Then do:

“adb logcat”

And you can try to narrow it down to only errors with: adb logcat *:E

OR there are more, like this:

V: Verbose
D: Debug
I: Info
W: Warning
E: Error
F: Fatal
S: Silent (highest priority, on which nothing is ever printed)

It will bring up TONS up stuff, no clue what most of it means. But if you narrow it down to errors, you can kind of pick through and see what the problem could be. Mine was that I didn’t add the plugins in my app.json, which you need to connect to firebase apps like this:

"plugins": [
  "@react-native-google-signin/google-signin",
  "@react-native-firebase/app",
  "@react-native-firebase/crashlytics",

I am still trying to get mine to work, I am onto a new problem, but it seemed to get me off what looks similar to yours. Let me know if you get anywhere as I am having trouble too with getting the EAS build to work on my emulator with the native modules.

Here is my app.json there is added firebase plugins as same yours :slight_smile:

development build works for cross platform.
production build works only IOS

But cant build

{
  "expo": {
    "name": "Kolay Zikir: ZikirMatik",
    "slug": "ZikirMatik-Tamaugi",
    "owner": "antiquemedia",
    "version": "1.7.6",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "dark",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#010B00"
    },
    "updates": {
      "fallbackToCacheTimeout": 6000,
      "enabled": true,
      "checkAutomatically": "ON_LOAD",
      "url": "https://u.expo.dev/****************-e5aa-46d5-b5df-74ef2eb581ef"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.antiquemedia.zikirmatik",
      "infoPlist": {
        "CFBundleAllowMixedLocalizations": true
      },
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "android": {
      "googleServicesFile": "./service-account-v02.json",
      "config": {
        "googleMobileAdsAppId": "ca-app-pub-**********~7444814863"
      },
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#010B00"
      },
      "package": "com.antiquemedia.zikirmatik"
    },
    "web": {
      "favicon": "./assets/icon.png",
      "bundler": "metro"
    },
    "experiments": {
      "tsconfigPaths": true
    },
    "scheme": "acme",
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 33,
            "targetSdkVersion": 33,
            "buildToolsVersion": "33.0.0"
          },
          "ios": {
            "deploymentTarget": "13.0",
            "useFrameworks": "static"
          }
        }
      ],
      [
        "expo-updates",
        {
          "username": "antiquemedia"
        }
      ],
      "expo-localization",
      "./plugins/withAndroidStrategiesPlugin.js",
      "expo-router",
      "@react-native-google-signin/google-signin",
      "@react-native-firebase/app",
      "@react-native-firebase/auth",
      "react-native-iap"
    ],
    "extra": {
      "eas": {
        "projectId": "********-e5aa-46d5-b5df-74ef2eb581ef"
      }
    },
    "locales": {
      "tr": "./languages/turkish.json",
      "en": "./languages/english.json"
    },
    "runtimeVersion": {
      "policy": "sdkVersion"
    }
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-************~7444814863",
    "ios_app_id": "ca-app-pub-*****************~7991609772",
    "delay_app_measurement_init": true,
  }
}

Most likely modules that don’t update because they are relying on old dependencies. I think I had to uninstall recaptcha and it worked for me. I can’t remember the exact thing I uninstalled. You just need to go through the “npx expo-doctor” and use the adb logcat that I explained. It might be like finding a needle in a haystack, but see if anything strange is jumping out at you in the adb logcat.

thank you for response steven,
i found the problem.
in expo sdk 49 ‘@react-native-google-signin/google-signin package’ fails error on android when i uninstalled pack build works fine

I have the same or a similar issue.

From my build:

Running 'gradlew :app:assembleDebug' in /home/expo/workingdir/build/android

Downloading https://services.gradle.org/distributions/gradle-8.0.1-all.zip

10%.

20%.

30%

40%

50%

60

%.

70%.

80%.

90%

100%

Welcome to Gradle 8.0.1!

Here are the highlights of this release:

- Improvements to the Kotlin DSL

 - Fine-grained parallelism from the first build with configuration cache

 - Configurable Gradle user home cache cleanup

For more details see https://docs.gradle.org/8.0.1/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.0.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.

Daemon will be stopped at the end of the build

> Task :expo-updates-gradle-plugin:pluginDescriptors

> Task :expo-updates-gradle-plugin:processResources

> Task :gradle-plugin:pluginDescriptors

> Task :expo-dev-launcher-gradle-plugin:pluginDescriptors

> Task :gradle-plugin:processResources

> Task :expo-dev-launcher-gradle-plugin:processResources

> Task :expo-dev-launcher-gradle-plugin:compileKotlin

> Task :expo-dev-launcher-gradle-plugin:compileJava NO-SOURCE

> Task :expo-dev-launcher-gradle-plugin:classes

> Task :expo-dev-launcher-gradle-plugin:jar

> Task :expo-dev-launcher-gradle-plugin:inspectClassesForKotlinIC

> Task :gradle-plugin:compileKotlin

> Task :gradle-plugin:compileJava NO-SOURCE

> Task :gradle-plugin:classes

> Task :gradle-plugin:jar

> Task :gradle-plugin:inspectClassesForKotlinIC

> Task :expo-updates-gradle-plugin:compileKotlin

> Task :expo-updates-gradle-plugin:compileJava NO-SOURCE

> Task :expo-updates-gradle-plugin:classes

> Task :expo-updates-gradle-plugin:jar

> Task :expo-updates-gradle-plugin:inspectClassesForKotlinIC

> Configure project :app

 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@2.4.8)

 ℹ️  Applying gradle plugin 'expo-updates-gradle-plugin' (expo-updates@0.18.11)

> Configure project :expo-av

Checking the license for package NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/licenses

License for package NDK (Side by side) 23.1.7779620 accepted.

Preparing "Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)".

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" ready.

Installing NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/ndk/23.1.7779620

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" complete.

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" finished.

Checking the license for package CMake 3.22.1 in /home/expo/Android/Sdk/licenses

License for package CMake 3.22.1 accepted.

Preparing "Install CMake 3.22.1 (revision: 3.22.1)".

"Install CMake 3.22.1 (revision: 3.22.1)" ready.

Installing CMake 3.22.1 in /home/expo/Android/Sdk/cmake/3.22.1

"Install CMake 3.22.1 (revision: 3.22.1)" complete.

"Install CMake 3.22.1 (revision: 3.22.1)" finished.

[stderr] 

FAILURE: Build completed with 2 failures.

[stderr] 

1: Task failed with an exception.

[stderr] 

-----------

[stderr] 

* Where:

[stderr] 

Build file '/home/expo/workingdir/build/node_modules/expo-firebase-analytics/android/build.gradle' line: 40

[stderr] 

* What went wrong:

[stderr] 

A problem occurred evaluating project ':expo-firebase-analytics'.

[stderr] 

> Could not set unknown property 'classifier' for task ':expo-firebase-analytics:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

[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] 

A problem occurred configuring project ':expo'.

[stderr] 

> compileSdkVersion is not specified. Please add it to build.gradle

[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 3m 6s

15 actionable tasks: 15 executed

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

These are my dependencies:

"dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-firebase/analytics": "15.4.0",
    "@react-native-firebase/app": "15.4.0",
    "@react-native-firebase/crashlytics": "15.4.0",
    "@react-native-firebase/firestore": "15.4.0",
    "@react-navigation/bottom-tabs": "^6.0.5",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.9.13",
    "@reduxjs/toolkit": "^1.8.0",
    "@types/react-redux": "^7.1.25",
    "expo": "^49.0.0",
    "expo-asset": "~8.10.1",
    "expo-av": "~13.4.1",
    "expo-build-properties": "~0.8.3",
    "expo-constants": "~14.4.2",
    "expo-dev-client": "~2.4.10",
    "expo-firebase-analytics": "^8.0.0",
    "expo-font": "~11.4.0",
    "expo-keep-awake": "~12.3.0",
    "expo-linking": "~5.0.2",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "expo-updates": "~0.18.13",
    "expo-web-browser": "~12.3.2",
    "jest": "^29.2.1",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "0.72.4",
    "react-native-chart-kit": "^6.12.0",
    "react-native-confetti-cannon": "^1.5.2",
    "react-native-copilot": "^3.2.1",
    "react-native-draggable-flatlist": "^4.0.1",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-elements": "^4.0.0-beta.0",
    "react-native-event-listeners": "^1.0.7",
    "react-native-floating-action": "^1.22.0",
    "react-native-fontawesome": "^7.0.0",
    "react-native-gesture-handler": "^2.12.0",
    "react-native-marquee-view": "^1.0.5",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-svg": "13.9.0",
    "react-native-web": "~0.19.6",
    "react-native-webview": "13.2.2",
    "react-native-wheely": "^0.6.0",
    "react-redux": "^7.2.6",
    "redux": "^4.1.2",
    "rn-tooltip": "^3.0.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@testing-library/jest-native": "^5.4.3",
    "@testing-library/react-native": "^12.2.2",
    "@types/jest": "^29.5.4",
    "@types/react": "~18.2.14",
    "@types/react-test-renderer": "^18.0.0",
    "@types/redux-logger": "^3.0.9",
    "@types/redux-mock-store": "^1.0.3",
    "eslint": "^8.10.0",
    "eslint-plugin-react": "^7.29.3",
    "eslint-plugin-react-hooks": "^4.3.0",
    "jest-expo": "^49.0.0",
    "react-native-svg-transformer": "^1.1.0",
    "react-test-renderer": "^18.2.0",
    "redux-logger": "^3.0.6",
    "redux-mock-store": "^1.5.4",
    "typescript": "^5.1.3"
  },

Anyone know what could possibly be wrong?

A problem occurred evaluating project ‘:expo-firebase-analytics’

this package is no longer supported. expo-firebase-* packages were deprecated in sdk 47: https://blog.expo.dev/expo-sdk-47-a0f6f5c038af

1 Like

You have both of these installed. Uninstall expo-firebase-analytics. As Brent says, it’s no longer supported

Thanks for the replies. I’ve gone ahead and removed the expo firebase package, but now I’m getting a different error saying

The Crashlytics build ID is missing. This occurs when the Crashlytics Gradle plugin is missing from your app's build configuration.

Given I’m using managed workflow, I don’t want to have to eject to fix this.

The React Native Firebase Docs has an Expo section saying this is managed by the config plugin that’s part of that package.

I actually removed it from my app.json plugins array and somehow am still getting the error. Is there an additional setup step I need to do in the Firebase console? I figured it would just work out of the box with my Google Services json files.

I can’t find anything online to point in me in the right direction. Any advice would be greatly appreciated!

You don’t need to eject. In the past you would have had to eject in order to make the necessary changes to build.gradle. These days, a config plugin will make these changes for you automatically during the build process, as long as you have added it to the plugins array in app.json.

Right.

No, it needs to be there if you’re using crashlytics.

As per the documentation:
React Native Firebase - Expo Managed Workflow

you need something like this:

{
  "expo": {
    "android": {
      "googleServicesFile": "./google-services.json"
    },
    "ios": {
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/perf",
      "@react-native-firebase/crashlytics"
    ]
  }
}

(But leave out the “perf” one, since you don’t have it installed.)

I’ve never set this up before, so I’m not sure what else you might need to do in the Firebase console, but I am pretty sure that as long as you have the Google Services files and the right plugins the app should build. If you need to do stuff in the console then I think you would probably run into problems when running the app rather than during the build process.

If you’re still getting the error, can you post your app.json (with any sensitive info redacted)?

Thanks for your attention. I actually just managed to fix my issue.

The problem was with how I was initializing Firebase. Too bad this isn’t well documented.

I was previously initializing it like this:

firebase.initializeApp({ <config> });

I changed it to:

!firebase.apps.length ? firebase.initializeApp({ <config> }) : firebase.app();

and the error went away. I’m not sure why it needs to be done this way, however.

I’m glad you got it working.

I suppose you’d need to ask the @react-native-firebase people that

@fitnesswolf is google sign in works after build ? or you removed