expo: [SDK 45.0.6 RN 0.69.3] - [Android] - package expo.modules does not exist in MainApplication.java

Summary

I can’t compile android after upgrade to expo sdk 45 I have tested for ios, works well

Existing Apps Setting up the expo package https://github.com/expo/fyi/blob/main/expo-modules-migration.md

error appears in log :

Task :app:compressReleaseAssets Execution optimizations have been disabled for task ‘:app:compressReleaseAssets’ to ensure correctness due to the following reasons:

  • Gradle detected a problem with the following location: ‘/Users/momo/Documents/test/test_expo/android/app/build/intermediates/assets/release/mergeReleaseAssets’. Reason: Task ‘:app:compressReleaseAssets’ uses this output of task ‘:app:copyReleaseBundledJs’ without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

Task :app:compileReleaseJavaWithJavac FAILED /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainApplication.java:27: error: package expo.modules does not exist import expo.modules.ApplicationLifecycleDispatcher; ^ /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainApplication.java:28: error: package expo.modules does not exist import expo.modules.ReactNativeHostWrapper; ^ /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainActivity.java:8: error: package expo.modules does not exist import expo.modules.ReactActivityDelegateWrapper; ^ /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainApplication.java:31: error: cannot find symbol private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper( ^ symbol: class ReactNativeHostWrapper location: class MainApplication /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainApplication.java:85: error: cannot find symbol ApplicationLifecycleDispatcher.onApplicationCreate(this); ^ symbol: variable ApplicationLifecycleDispatcher location: class MainApplication /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainApplication.java:91: error: cannot find symbol ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); ^ symbol: variable ApplicationLifecycleDispatcher location: class MainApplication /Users/momo/Documents/test/test_expo/android/app/src/main/java/com/test_expo/MainActivity.java:38: error: cannot find symbol return new ReactActivityDelegateWrapper( ^ symbol: class ReactActivityDelegateWrapper location: class MainActivity Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 7 errors w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:compileReleaseJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • 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.

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.4.2/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 2 invalid unit(s) of work during this build to ensure correctness. Please consult deprecation warnings for more details.

BUILD FAILED in 4m 15s 773 actionable tasks: 727 executed, 46 up-to-date Dealing with validation problems

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

0.45.6

Environment

System: OS: macOS 12.4 CPU: (12) x64 Intel® Core™ i7-8850H CPU @ 2.60GHz Memory: 26.73 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.11.0 - /usr/local/bin/npm Watchman: 2022.07.04.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.3 => 0.69.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

npmPackages:
  react (18.0.0)
  react-native (0.69.3)
  expo 45.0.6
  expo-application (4.1.0)
  expo-constants (13.1.1)
  expo-file-system (14.0.0)
  expo-font (10.1.0)
  expo-image-loader (3.2.0)
  expo-image-manipulator (10.3.1)
  expo-in-app-purchases (13.0.0)
  expo-location (14.2.2)
  expo-modules-core (0.9.2)
  
  AGP version is 7.4.2-all
    classpath("com.android.tools.build:gradle:7.1.1")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath("de.undercouch:gradle-download-task:5.0.1")

Reproducible demo

Just upgrade to expo 45.0.6

https://github.com/expo/fyi/blob/main/expo-modules-migration.md image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Now its working, i created new react native project with expo and started to compare android folder files with mine. i dont know what exactly fixed the issue but what think it fixed the issue is inside settings.gradle

before:

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute().text.trim(), "../scripts/autolinking.gradle");
useExpoModules()

include ':app'
includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

after:

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()

include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

Hello there!

Did you find a solution or a way around this mess?

Getting this issue on expo: ^49.0.2 too

@saif-o99 No, that error still blocks me

same issue . please help me @Kudo