nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.56k stars 2.25k forks source link

Android build failing in Expo App #24138

Closed kalingaCoder closed 1 week ago

kalingaCoder commented 1 month ago

Current Behavior

From the workspace folder: Run npx expo, select open Android by typing 'a'

  1. _Android Bundling failed 3038ms (C:\code\dhrona_z\node_modules\expo\AppEntry.js) Unable to resolve "../../App" from "nodemodules\expo\AppEntry.js"
  1. When scanned from expo go app, it shows the following error: The installed version of Expo go is for SDK 51, The project you open uses sdk 50.

Expected Behavior

  1. Android Build should have been successful & ran the application in Android studio.
  2. The generated app should have been compatible with the latest expo go app which is using sdk 51.

GitHub Repo

https://github.com/kalingaCoder/ExpoNx

Steps to Reproduce

1.create-nx-workspace@latest

NX Let's create a new workspace [https://nx.dev/getting-started/intro]

√ Where would you like to create your workspace? · og √ Which stack do you want to use? · react √ What framework would you like to use? · nextjs √ Integrated monorepo, or standalone project? · integrated √ Application name · nextApp √ Would you like to use the App Router (recommended)? · Yes √ Would you like to use the src/ directory? · Yes √ Test runner to use for end to end (E2E) tests · none √ Default stylesheet format · tailwind √ Do you want Nx Cloud to make your CI fast? · skip

NX Creating your v19.0.5 workspace.

  1. nx add @nx/expo
  2. npx nx generate @nx/expo:application --name=expoApp --directory=./apps/expoApp --e2eTestRunner=none --projectNameAndRootFormat=as-provided --unitTestRunner=none --no-interactive
  3. nx install expoApp --check Downgraded react native svg package as per the reccommendation version & now nx install expoApp --check is successful without any recommendations.
    1. Added android package name in the app.json of expo app.
    2. npx expo --> throws error

Nx Report

Node   : 21.6.1
OS     : win32-x64
yarn   : 1.22.22

nx (global)        : 19.0.4
nx                 : 19.0.5
@nx/js             : 19.0.5
@nx/jest           : 19.0.5
@nx/linter         : 19.0.5
@nx/eslint         : 19.0.5
@nx/workspace      : 19.0.5
@nx/devkit         : 19.0.5
@nx/eslint-plugin  : 19.0.5
@nx/expo           : 19.0.5
@nx/react          : 19.0.5
@nrwl/tao          : 19.0.5
@nx/web            : 19.0.5
@nx/webpack        : 19.0.5
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/expo/plugin
@nx/eslint/plugin

Failure Logs

› Opening on Android...
› Opening exp://192.168.29.64:8082 on Pixel_5_API_34
√ Expo Go on Pixel_5_API_34 is outdated, would you like to upgrade? ... yes
Uninstalling Expo Go from android device Pixel_5_API_34.
› Press ? │ show all commands
Android Bundling failed 3038ms (C:\code\dhrona_z\node_modules\expo\AppEntry.js)
Unable to resolve "../../App" from "node_modules\expo\AppEntry.js"

Package Manager Version

No response

Operating System

Additional Information

Web build was successful.

kalingaCoder commented 1 month ago

@xiongemi - If possible please provide the ETA So that I can plan accordingly

xiongemi commented 4 weeks ago

i checkout your repo, at workspace root, I ran nx start expoApp, then I enter a to run on android. it seems fine for me. i am able to launch your app in android emulator:

Screenshot_1716916650

kalingaCoder commented 4 weeks ago

On executing the command it is directly opening the web in the browser it is not asking for Android.

_dhrona_z> nx start expoApp

nx run expoApp:start

expo start

Starting project at C:\code\dhronaz\apps\expoApp (node:16600) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) Using src/app as the root directory for Expo Router. Starting Metro Bundler Waiting on http://localhost:8081 Logs for your project will appear below.

xiongemi commented 2 weeks ago

the quick workaround would be add target to expoApp's project.json:

"targets": {
  "start": {
      "executor": "@nx/expo:start"
  }
}

then it could be run on windows for start command nx start expoApp i will do a proper fix.

kalingaCoder commented 1 week ago

Need solution for this issue aswell: When scanned from expo go app, it shows the following error: The installed version of Expo go is for SDK 51, The project you open uses sdk 50.