Error Building react-native app with EAS

SDK Version: 48.0.0
Platform: Android

Hey while learning React Native I tried to build my first todo app (for android only) with EAS.
Unfortunately the built process failed.

My package.json file:

{
  "name": "todoapp",
  "version": "1.0.0",
  "keywords": [
    "react",
    "expo",
    "template",
    "nativebase"
  ],
  "license": "MIT",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-navigation/drawer": "^6.6.0",
    "@react-navigation/native-stack": "^6.9.10",
    "@react-navigation/stack": "^6.3.14",
    "expo": "^48.0.0",
    "expo-linear-gradient": "~12.1.1",
    "expo-notifications": "~0.18.1",
    "expo-splash-screen": "~0.18.1",
    "expo-status-bar": "~1.4.4",
    "native-base": "3.4.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.3",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-svg": "13.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "bugs": {
    "url": "https://github.com/GeekyAnts/nativebase-templates/issues"
  },
  "homepage": "https://github.com/GeekyAnts/nativebase-templates#readme",
  "author": "Aditya Jamuar",
  "private": true
}

Run Gradlew output:

> Task :expo:bundleLibResRelease

> Task :app:compileReleaseJavaWithJavac FAILED

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainActivity.java:19: error: package R does not exist

[stderr] 
    setTheme(R.style.AppTheme);

[stderr] 
              ^

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainActivity.java:39: error: cannot find symbol

[stderr] 
    return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(

[stderr] 
                                                  ^

[stderr] 
  symbol:   variable BuildConfig

[stderr] 
  location: class MainActivity

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:26: error: cannot find symbol

[stderr] 
        return BuildConfig.DEBUG;

[stderr] 
               ^

[stderr] 
  symbol: variable BuildConfig

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:45: error: cannot find symbol

[stderr] 
        return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;

[stderr] 
               ^

[stderr] 
  symbol: variable BuildConfig

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:50: error: cannot find symbol

[stderr] 
        return BuildConfig.IS_HERMES_ENABLED;

[stderr] 
               ^

[stderr] 
  symbol: variable BuildConfig

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:63: error: cannot find symbol

[stderr] 
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {

[stderr] 
        ^

[stderr] 
  symbol:   variable BuildConfig

[stderr] 
  location: class MainApplication

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:63: error: illegal parenthesized expression

[stderr] 
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {

[stderr] 
       ^

[stderr] 
/home/expo/workingdir/build/todoapp/android/app/src/main/java/com/rootsquid/todoapp/MainApplication.java:67: error: cannot find symbol

[stderr] 
    ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());

[stderr] 
    ^

[stderr] 
  symbol:   variable ReactNativeFlipper

[stderr] 
  location: class MainApplication

[stderr] 
8 errors

w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.

Please consult deprecation warnings for more details.

211 actionable tasks: 211 executed

[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:compileReleaseJavaWithJavac'.

[stderr] 
> Compilation failed; see the compiler error output for details.

[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 5m 57s

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

Hi @rootsquid

What is the history of that package.json? It looks like it was created with an older version of expo-cli (because it has an eject script which is no longer valid, and it also has react-dom as a dependency) and also it’s got stuff in there that looks like it’s from the NativeBase project.

Since you don’t have react-native-web installed, you should probably remove react-dom. Otherwise there’s nothing obviously wrong with your package.json.

Do you have an android directory in the app by any chance? Also, do you have a "plugins" section in app.json? If so, can you post it?

EDIT: I created a new app with the dependencies from your package.json and I was able to build it with no errors.

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