Error on EAS Android build after updating from SDK 44 to SDK 45

Please provide the following:

  1. SDK Version: 45
  2. Platforms(Android):
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

After migrating from SDK 44 to SDK 45 by following the guide, all my eas builds are returning the following errors after failing:

Running './gradlew :app:assembleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-6.9-all.zip
Unzipping /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9-all.zip to /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs
Set executable permissions for: /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9/bin/gradle
Welcome to Gradle 6.9!
Here are the highlights of this release:
 - This is a small backport release.
 - Java 16 can be used to compile when used with Java toolchains
 - Dynamic versions can be used within plugin declarations
 - Native support for Apple Silicon processors
For more details see https://docs.gradle.org/6.9/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.9/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
[stderr] 
FAILURE: Build failed with an exception.
[stderr] 
* Where:
[stderr] 
Script '/home/expo/workingdir/build/node_modules/react-native/react.gradle' line: 41
[stderr] 
* What went wrong:
[stderr] 
A problem occurred configuring project ':app'.
[stderr] 
> Could not find matching constructor for: java.io.File(File)
[stderr] 
* Try:
[stderr] 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 42s
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

So the main error is regarding the File(…) constructor that cannot be found.

> Could not find matching constructor for: java.io.File(File)

I already ran $ expo doctor many times & all my dependencies are satisfying.

I am not sure if I missed something during the migration.

Hi @codingmotion

Try removing your package-lock.json / yarn.lock and node_modules and re-installing your dependencies.

If that doesn’t help, please post your dependencies and devDependencies here.

Hi @wodin

after removing the node-modules and yarn.lock locally, reinstalling all the modules & running expo run:android locally, I am still having the same previous error.

Here is the command I ran in my project root folder:
$ rm -rf node_modules yarn.lock && yarn install && expo run:android

I already installed JDK 11:

java version "11.0.15.1" 2022-04-22 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15.1+2-LTS-10)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15.1+2-LTS-10, mixed mode)

Here is the error I got when building locally on my mac.

› Building app...
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* Where:
Script '.../lettalk-app/node_modules/react-native/react.gradle' line: 41

* What went wrong:
A problem occurred configuring project ':app'.
> Could not find matching constructor for: java.io.File(File)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s

And here are my dependencies:

"dependencies": {
    "@expo/react-native-action-sheet": "^3.13.0",
    "@expo/vector-icons": "^13.0.0",
    "@manu_omg/react-native-emoji-selector": "^1.0.3",
    "@miblanchard/react-native-slider": "^2.1.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-community/slider": "4.2.1",
    "@react-native-masked-view/masked-view": "0.2.6",
    "@react-navigation/bottom-tabs": "^6.2.0",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/stack": "^6.1.1",
    "axios": "^0.21.1",
    "expo": "^45.0.0",
    "expo-app-loading": "~2.0.0",
    "expo-asset": "~8.5.0",
    "expo-av": "~11.2.3",
    "expo-camera": "~12.2.0",
    "expo-clipboard": "~3.0.1",
    "expo-constants": "~13.1.1",
    "expo-dev-client": "~1.0.1",
    "expo-facebook": "~12.2.0",
    "expo-firebase-analytics": "~7.0.0",
    "expo-font": "~10.1.0",
    "expo-image-picker": "~13.1.1",
    "expo-keep-awake": "~10.1.1",
    "expo-linear-gradient": "~11.3.0",
    "expo-linking": "~3.1.0",
    "expo-localization": "~13.0.0",
    "expo-location": "~14.2.2",
    "expo-notifications": "~0.15.4",
    "expo-secure-store": "~11.2.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.3",
    "expo-video-thumbnails": "~6.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-3dcube-navigation": "^1.0.4",
    "react-native-agora": "^3.7.1",
    "react-native-animatable": "^1.3.3",
    "react-native-elements": "^1.2.7",
    "react-native-fast-image": "^8.5.11",
    "react-native-flash-message": "^0.2.1",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-image-crop-picker": "^0.37.3",
    "react-native-image-keyboard": "^2.0.5",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-loading-spinner-overlay": "^3.0.0",
    "react-native-modalize": "^2.0.13",
    "react-native-pager-view": "5.4.15",
    "react-native-paper": "^4.11.2",
    "react-native-parsed-text": "^0.0.22",
    "react-native-popover-view": "^4.1.0",
    "react-native-portalize": "^1.0.7",
    "react-native-progress-steps": "^1.3.4",
    "react-native-reanimated": "~2.8.0",
    "react-native-root-toast": "^3.3.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-share-menu": "^5.0.5",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "12.3.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^2.11.0",
    "react-native-text-ticker": "^1.14.0",
    "react-native-timeago": "^0.5.0",
    "react-native-track-player": "^2.1.2",
    "react-native-typing-animation": "^0.1.7",
    "react-native-video": "^5.2.0",
    "react-native-video-controls": "^2.8.1",
    "react-native-web": "0.17.7",
    "react-native-webview": "11.18.1",
    "react-number-format": "^4.9.1",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "rxjs": "^6.5.5",
    "socket.io-client": "^4.4.0",
    "url": "^0.11.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/lodash": "^4.14.179",
    "@types/react": "~17.0.21",
    "@types/react-native-snap-carousel": "^3.8.5",
    "@types/react-redux": "^7.1.7",
    "@types/socket.io-client": "^1.4.33",
    "babel-preset-expo": "~9.1.0",
    "jest-expo": "^45.0.0",
    "metro-minify-terser": "^0.66.2",
    "swagger-axios-codegen": "^0.11.16",
    "typescript": "~4.3.5"
  },

Ah, OK, so you have a Bare app.

See if this helps? (I’m not very familiar with bare apps, though):

What might also help is (after making sure you have everything committed to Git so that you can revert the changes), try running expo prebuild -p android --clean to see if there are any relevant differences between what expo prebuild generates and what your code looks like.

By the way, if you don’t mind me asking, why are you on the Bare workflow?

The reason why we switched to Bare Workflow :

We started with the Managed Workflow (Expo-Go).
But at certain time during the last year, we were limited not to install some natives libraries that we needed for certains features like RTC.

After the release of EAS in Expo, we decided to switch to Bare-Workflow to generate our own Custom-DEV-Clients to have the ability to install all that native packages.

BTW, we are very fan of the EAS and Expo in our Team :tada:.

I don’t know, but is it already possible to install natives modules using the Managed-Workflow ? May be I missed something.

1 Like

Yes! :slight_smile:

One of the big reasons for EAS Build was to enable this.
Depending on the module you might need a config plugin. Some things include their own config plugin (some examples), but because it’s still quite new, you might need to write your own config plugin to support certain dependencies.

Many dependencies don’t even need a config plugin (a few examples).

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