package com.okcareapp.generated does not exist

I tried to build the expo project but got stuck with an error
Build execution command:

  • eas build -p android --profile preview

error:

> Task :app:compileReleaseJavaWithJavac FAILED
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:14: error: package com.okcareapp.generated does not exist
[stderr] 
import com.okcareapp.generated.BasePackageList;
[stderr] 
                              ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:16: error: package org.unimodules.adapters.react does not exist
[stderr] 
import org.unimodules.adapters.react.ReactAdapterPackage;
[stderr] 
                                    ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:17: error: package org.unimodules.adapters.react does not exist
[stderr] 
import org.unimodules.adapters.react.ModuleRegistryAdapter;
[stderr] 
                                    ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:18: error: package org.unimodules.adapters.react does not exist
[stderr] 
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
[stderr] 
                                    ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:19: error: package org.unimodules.core.interfaces does not exist
[stderr] 
import org.unimodules.core.interfaces.Package;
[stderr] 
                                     ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:20: error: package org.unimodules.core.interfaces does not exist
[stderr] 
import org.unimodules.core.interfaces.SingletonModule;
[stderr] 
                                     ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:22: error: package expo.modules.permissions does not exist
[stderr] 
import expo.modules.permissions.PermissionsPackage;
[stderr] 
                               ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:35: error: cannot find symbol
[stderr] 
  private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
[stderr] 
                ^
[stderr] 
  symbol:   class ReactModuleRegistryProvider
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:35: error: cannot find symbol
[stderr] 
  private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
[stderr] 
                                                                          ^
[stderr] 
  symbol:   class ReactModuleRegistryProvider
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:36: error: cannot find symbol
[stderr] 
    new BasePackageList().getPackageList()
[stderr] 
        ^
[stderr] 
  symbol:   class BasePackageList
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:42: error: cannot find symbol
[stderr] 
      return BuildConfig.DEBUG;
[stderr] 
             ^
[stderr] 
  symbol: variable BuildConfig
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:48: error: cannot find symbol
[stderr] 
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
[stderr] 
                       ^
[stderr] 
  symbol: class ModuleRegistryAdapter
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:64: error: cannot find symbol
[stderr] 
      if (BuildConfig.DEBUG) {
[stderr] 
          ^
[stderr] 
  symbol: variable BuildConfig
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:64: error: illegal parenthesized expression
[stderr] 
      if (BuildConfig.DEBUG) {
[stderr] 
         ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:73: error: cannot find symbol
[stderr] 
      if (BuildConfig.DEBUG) {
[stderr] 
          ^
[stderr] 
  symbol: variable BuildConfig
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:73: error: illegal parenthesized expression
[stderr] 
      if (BuildConfig.DEBUG) {
[stderr] 
         ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:91: error: cannot find symbol
[stderr] 
    if (!BuildConfig.DEBUG) {
[stderr] 
         ^
[stderr] 
  symbol:   variable BuildConfig
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:107: error: cannot find symbol
[stderr] 
    if (BuildConfig.DEBUG) {
[stderr] 
        ^
[stderr] 
  symbol:   variable BuildConfig
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/com/okcareapp/MainApplication.java:107: error: illegal parenthesized expression
[stderr] 
    if (BuildConfig.DEBUG) {
[stderr] 
       ^
[stderr] 
Note: Some input files use or override a deprecated API.
[stderr] 
Note: Recompile with -Xlint:deprecation for details.
[stderr] 
19 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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 7 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
1534 actionable tasks: 1534 executed
[stderr] 
FAILURE: Build failed with an exception.
[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] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 8m 54s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Can you tell me the cause and solution? :pray:

Hi @choisunah

What Expo SDK version number are you using?

Do you have an android directory in your app?

What do you get if you run npx expo-doctor?

Do you have unimodules mentioned anywhere in your package.json?

Hi @wodin

I made the project a bare project and below is the information I have set up

  1. Expo SDK version: 46.0.0
    ( In app.json it says runtimeVersion": "exposdk:46.0.0 I don’t know if it’s set up correctly…)

  2. I have android folder

  3. npx expo-doctor execution command:
WARNING: We recommend using PowerShell or Bash via WSL 2 for development with Expo CLI on Windows. You may encounter issues using cmd.exe.

√ Validating global prerequisites versions
√ Checking for incompatible packages
√ Checking for conflicting global packages in project
× Verifying prebuild support package versions are compatible
Issues:
  Expected package @expo/config-plugins@^5.0.0
  Found invalid:
    @expo/config-plugins@4.1.5
    @expo/config-plugins@4.1.5
    (for more info, run: npm why @expo/config-plugins)
Advice:
  • Upgrade dependencies that are using the invalid package versions.
× Checking dependency versions for compatibility with the installed Expo SDK
Issues:
  'sh'��(��) ���� �Ǵ� �ܺ� ����, ������ �� �ִ� ���α׷�, �Ǵ�
  ��ġ ������ �ƴմϴ�.
Advice:
  • Use npx expo install --check to review and upgrade your dependencies.
√ Validating Expo Config
× Checking package.json for common issues
Issues:
  The package "expo-modules-core" should not be installed directly in your project. It is a dependency of other Expo packages and should be installed automatically.

✖ Found one or more possible issues with the project. See above logs for issues and advice to resolve.

4. not having unimodules in package.json

-----------------------------------------------------------------------------------------------------------------

I tried to solve the issue after entering the npx expo-doctor command
So I have tried below commands

  1. yarn add @expo/config-plugins@latest
  2. npx expo install --check
  3. yarn remove expo-modules-core

but got a new error…:sob::x:

> Task :app:compileReleaseJavaWithJavac FAILED
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainActivity.java:8: error: package com.facebook.react.defaults does not exist
[stderr] 
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
[stderr] 
                                  ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainActivity.java:9: error: package com.facebook.react.defaults does not exist
[stderr] 
import com.facebook.react.defaults.DefaultReactActivityDelegate;
[stderr] 
                                  ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:11: error: package com.facebook.react.defaults does not exist
[stderr] 
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
[stderr] 
                                  ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:12: error: package com.facebook.react.defaults does not exist
[stderr] 
import com.facebook.react.defaults.DefaultReactNativeHost;
[stderr] 
                                  ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainActivity.java:39: error: cannot find symbol
[stderr] 
    return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
[stderr] 
                                                                                               ^
[stderr] 
  symbol:   class DefaultReactActivityDelegate
[stderr] 
  location: class MainActivity
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainActivity.java:43: error: cannot find symbol
[stderr] 
        DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
[stderr] 
        ^
[stderr] 
  symbol:   variable DefaultNewArchitectureEntryPoint
[stderr] 
  location: class MainActivity
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainActivity.java:45: error: cannot find symbol
[stderr] 
        DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
[stderr] 
        ^
[stderr] 
  symbol:   variable DefaultNewArchitectureEntryPoint
[stderr] 
  location: class MainActivity
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:23: error: cannot find symbol
[stderr] 
    new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {
[stderr] 
                                         ^
[stderr] 
  symbol:   class DefaultReactNativeHost
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:24: error: method does not override or implement a method from a supertype
[stderr] 
      @Override
[stderr] 
      ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:29: error: method does not override or implement a method from a supertype
[stderr] 
      @Override
[stderr] 
      ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:32: error: no suitable constructor found for PackageList(<anonymous DefaultReactNativeHost>)
[stderr] 
        List<ReactPackage> packages = new PackageList(this).getPackages();
[stderr] 
                                      ^
[stderr] 
    constructor PackageList.PackageList(ReactNativeHost) is not applicable
[stderr] 
      (argument mismatch; <anonymous DefaultReactNativeHost> cannot be converted to ReactNativeHost)
[stderr] 
    constructor PackageList.PackageList(Application) is not applicable
[stderr] 
      (argument mismatch; <anonymous DefaultReactNativeHost> cannot be converted to Application)
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:38: error: method does not override or implement a method from a supertype
[stderr] 
      @Override
[stderr] 
      ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:43: error: method does not override or implement a method from a supertype
[stderr] 
      @Override
[stderr] 
      ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:48: error: method does not override or implement a method from a supertype
[stderr] 
      @Override
[stderr] 
      ^
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:50: error: cannot find symbol
[stderr] 
        return BuildConfig.IS_HERMES_ENABLED;
[stderr] 
                          ^
[stderr] 
  symbol:   variable IS_HERMES_ENABLED
[stderr] 
  location: class BuildConfig
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:65: error: cannot find symbol
[stderr] 
      DefaultNewArchitectureEntryPoint.load();
[stderr] 
      ^
[stderr] 
  symbol:   variable DefaultNewArchitectureEntryPoint
[stderr] 
  location: class MainApplication
[stderr] 
/home/expo/workingdir/build/android/app/src/main/java/okcare/infinitycare/medisol/MainApplication.java:67: error: cannot find symbol
[stderr] 
    ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
[stderr] 
    ^
[stderr] 
  symbol:   variable ReactNativeFlipper
[stderr] 
  location: class MainApplication
[stderr] 
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[stderr] 
17 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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 9 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
[stderr] 
FAILURE: Build failed with an exception.
[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] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 11m 25s
1536 actionable tasks: 1536 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Have you tried using PowerShell instead of cmd.exe? I don’t run Windows, so I can’t test how well this stuff works there. If I were running Windows I would probably run Expo inside Windows Subsystem for Linux (WSL).

OK, so it looks like you have an older version of @expo/config-plugins installed, or one of your dependencies depends on an old version of @expo/config-plugins.

Try running:

npm why "@expo/config-plugins@4.1.5"

:thinking: this looks like expo doctor is expecting to run on macOS or Linux and not Windows. I assume that mangled message is supposed to say something like “command not found”?

You should uninstall expo-modules-core.

You should not install expo packages using yarn directly because, especially if you’re on an older SDK version (like 46) it will install an incompatible version of the package.

You should either do npx expo install the_package_name or npx expo install --fix or npx expo install --check
You should generally not install @expo/config-plugins directly. It will be pulled in automatically by the other Expo dependencies.

OK.

Would you mind saying why you chose a Bare project instead of a Managed project?

Also, did you upgrade from an older Expo SDK version?

  1. I came in as a new developer at the company I am currently working for and took on a project that is causing problems.
    This project was made as a bare project, and this is an outsourced project requested from another company.
    It has just been completed, so it is difficult to analyze…

  2. Didn’t update sdk version (current 46.0.0)


I initialized the project and tried the commands as you told me

  1. npx expo install --check and --fix
    1-1) But this option doesn’t exist so I tried expo install
    1-2) however I got an error saying “Failed to resolve plugin for module ‘expo-notifications’ relative to
    in project”
    1-3) so I tried ‘yarn’ …worked fine

  2. npx expo install --fix again and it worked fine.

  3. npm why "@expo/config-plugins@4.1.5"

    @expo/config-plugins@4.1.5"
    I have been informed that manually deleting this package may cause problems with other packages using it.

PS C:\infinitycare\okcare-App> npm why "@expo/config-plugins@4.1.5"
@expo/config-plugins@4.1.5 dev
node_modules/@config-plugins/react-native-pdf/node_modules/@expo/config-plugins
  @expo/config-plugins@"^4.0.7" from @config-plugins/react-native-pdf@0.0.0
  node_modules/@config-plugins/react-native-pdf
    dev @config-plugins/react-native-pdf@"^0.0.0" from the root project

@expo/config-plugins@4.1.5 dev
node_modules/@config-plugins/react-native-blob-util/node_modules/@expo/config-plugins
  @expo/config-plugins@"^4.0.7" from @config-plugins/react-native-blob-util@0.0.0
  node_modules/@config-plugins/react-native-blob-util
    dev @config-plugins/react-native-blob-util@"^0.0.0" from the root project
  1. to solve the above problem
    I used command to update “@expo/config-plugins@4.1.5” in devDependency of “@config-plugins/react-native-pdf” and “@config-plugins/react-native-blob-util” packages
PS C:\infinitycare\okcare-App> yarn add @expo/config-plugins@latest --dev --cwd node_modules/@config-plugins/react-native-blob-util
yarn add v1.22.19
warning package.json: No license field
info No lockfile found.
warning @config-plugins/react-native-blob-util@0.0.0: No license field
[1/4] Resolving packages...
warning expo-module-scripts > jest-expo > babel-jest > @jest/transform > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added

.
but got an error (react-native-pdf, react-native-blob-util same error)

$ expo-module prepare
C:\infinitycare\okcare_App\node_modules\@config-plugins\react-native-blob-util\node_modules\expo-module-scripts\bin\expo-module-prepare:3
set -eo pipefail
        ^^^^^^^^

SyntaxError: Unexpected identifier
    at internalCompileFunction (node:internal/vm:74:18)


I see. Do you know if they made any changes to the native code other than what was necessary to integrate the dependencies? e.g. did they do any development in the native android and ios directories?

Could you elaborate on what you mean by this? Do you mean something like:

  • git clone <project-url>
  • cd <project-directory>
  • yarn

From your screenshot it looks like yarn.lock did not exist at the time when you ran the commands. You would need to run yarn first to install the dependencies. That’s probably why you got the errors about the “legacy expo-cli”. But just in case, check that you do not have expo-cli or eas-cli installed as dependencies in package.json. If you do, uninstall them. They should only be installed globally.

After that, the following should all work:

npx expo doctor
npx expo install --check
npx expo install --fix

OK

OK, so it looks like it’s being used by the config plugins for react-native-pdf and react-native-blob-util. It looks like you have version 0.0.0 of both of the config plugins.

But it looks like you should have @config-plugins/react-native-pdf@^3.0.0:

and @config-plugins/react-native-blob-util@^3.0.0:

Then you should be able to uninstall @expo/config-plugins.

I don’t have a lot of experience with the bare workflow or with running Expo on Windows. So I’m not sure if the above command is expected to work on Windows. However, I can tell you that it is trying to run a Unix-specific (macOS or Linux) command instead of a Windows command.

set -eo pipefail is something you can have in a Unix shell script. It will not work on Windows.

What I would do is this. First upgrade upgrade the config plugins mentioned above and uninstall @expo/config-plugins. Then:

  1. Make sure any changes you have made are committed to Git so that you can get them back if necessary, including your yarn.lock file (but of course not your node_modules.
  2. Delete the ios and android directories.
  3. Run eas build -p android --profile preview

If it fails again, post the errors here again.

If it builds, test that the app works correctly. If not, maybe the third party did make some changes to the native code. If so it gets more tricky. But first try the above and see what happens.