Expo 44: Android release variant fails, but everything else works (Android/iOS debug builds, iOS release)

Please provide the following:

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

Hey folks, I’ve been in the Infinite Red slack channel asking about this, but I wanted to create a thread that could be indexable and referenced in case someone has the fix.

I’ve got a bare workflow app. We ejected around Expo 37 or so. Recently I went and did a version-by-version Expo upgrade, up to Expo 44.

I merged that in, and I knew that my debug builds for both iOS and Android were working. Then I ran deployments for both iOS and Android releases. I used Fastlane for that, and everything worked.

A few days later, I merged in some changes only to .js files - some components and the like. I ran iOS simulator and Android emulator to validate the changes. Everything built and worked.

Then I used Fastlane to publish to iOS - it worked. But when I tried to deploy to Google Play, things started breaking.

I’ve seen a variety of error messages, and I’ll paste what I think is the fundamental one down below. But before I do that, it gets weirder.

Last Wednesday night, I got a successful Google Play fastlane deploy. The next day, without any code changes whatsoever, I attempted to do it again. It failed, and failed the same way it has been.

I made a reproduction project with the Expo 44 template, with expo init --template expo-template-blank@sdk-44 , and that works. So this might not be an Expo thing specifically, but I’m hoping the community has an idea what’s going on.

Here are some of the most common, weirdest errors I get. This output is after I did:

  1. rm -rf node_modules
  2. yarn install
  3. cd android
  4. ./gradlew clean (works)
  5. yarn android --variant=release

This output comes from the release variant build.

Thanks in advance for any help.

Note: Recompile with -Xlint:unchecked for details.
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:15: error: cannot find symbol
import expo.modules.ApplicationLifecycleDispatcher;
                   ^
  symbol:   class ApplicationLifecycleDispatcher
  location: package expo.modules
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:16: error: cannot find symbol
import expo.modules.ReactNativeHostWrapper;
                   ^
  symbol:   class ReactNativeHostWrapper
  location: package expo.modules
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:17: error: package expo.modules.constants does not exist
import expo.modules.constants.ConstantsPackage;
                             ^
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:18: error: package expo.modules.filesystem does not exist
import expo.modules.filesystem.FileSystemPackage;
                              ^
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainActivity.java:12: error: cannot find symbol
import expo.modules.ReactActivityDelegateWrapper;
                   ^
  symbol:   class ReactActivityDelegateWrapper
  location: package expo.modules
/Users/myusername/mobile-app/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:19: error: cannot find symbol
import expo.modules.ExpoModulesPackage;
                   ^
  symbol:   class ExpoModulesPackage
  location: package expo.modules
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:27: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
                                                       ^
  symbol:   class ReactNativeHostWrapper
  location: class MainApplication
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:63: error: cannot find symbol
    ApplicationLifecycleDispatcher.onApplicationCreate(this);
    ^
  symbol:   variable ApplicationLifecycleDispatcher
  location: class MainApplication
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainApplication.java:69: error: cannot find symbol
    ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
    ^
  symbol:   variable ApplicationLifecycleDispatcher
  location: class MainApplication
/Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainActivity.java:33: error: cannot find symbol
        return new ReactActivityDelegateWrapper(
                   ^
  symbol:   class ReactActivityDelegateWrapper
  location: class MainActivity
/Users/myusername/mobile-app/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:89: error: cannot find symbol
      new ExpoModulesPackage(),
          ^
  symbol:   class ExpoModulesPackage
  location: class PackageList
Note: /Users/myusername/mobile-app/android/app/src/main/java/com/company/appname/MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
11 errors

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.

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

BUILD FAILED in 5m 21s

    at makeError (/Users/myusername/mobile-app/node_modules/execa/index.js:174:9)
    at /Users/myusername/mobile-app/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/myusername/mobile-app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/Users/myusername/mobile-app/node_modules/@react-native-community/cli/build/index.js:186:9)

Just now, I tried to see if Android Studio would give me clearer errors. I ran a Gradle sync, which failed and said:

No variants found for ':expo'. Check build files to ensure at least one variant exists. at:
com.android.tools.idea.gradle.project.sync.AndroidModule.deliverModels(AndroidModule.kt:138)

The saga continues:

Coworker A is having the same error as me
Coworker B has no issue.

All three of us are running:

rm -rf node_modules
yarn install
cd android
./gradlew clean
yarn android --variant=release

Off the same commit on our main branch.

I’m going to reinstall my Android environment and see if that shakes anything out.

Reinstalling the Android environment hasn’t changed anything. I then tried running a React Native CLI project with npx react-native init AwesomeProject --version 0.63.4. yarn android --variant=release works in that project as well.

Ok, so honestly, this is the most confusing possible outcome of all of this:

Suddenly it’s inexplicably working. After nothing was working, I went back to the main branch, and I ran the following:

rm -rf node_modules
yarn install 
cd android
./gradlew clean
yarn android --variant=release

And I got BUILD SUCCESSFUL in 6m 39s

One big difference is that this time , I ran it from iTerm, rather than the built-in terminal in VS Code.

Then I decided to try Fastlane again. I did:

rm -rf node_modules
yarn install
cd android
bundle exec fastlane alpha

And it worked! I’ve just uploaded the .aab to Google Play. Looks like all the binary files are exactly the same as the last working build I pushed to that track.

I truly have no idea why this worked. At some point tonight, I ended up downloading a bunch of SDK build tools and stuff from my newly installed Android Studio environment. Maybe I was missing something, and I ended up getting what I needed? Or perhaps something matters between iTerm and VS Code integrated terminal?

I’m feeling reasonably satisfied that any problems we’ve got are not coming from the codebase itself, but from folks’ environments. But maybe this will be helpful for someone else who does an Expo upgrade and thinks it broke their app.

1 Like

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