Invariant Violation: AsyncStorage has been removed from react-native core. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'.

Thanks i just committed

Sorry, I misremembered. You do actually have @react-navigation/drawer in your imports.

Unfortunately you can’t do this blindly. e.g. Native Base changed quite a bit between version 2 and version 3. I would avoid upgrading it until you have the building and Firebase issues sorted out. When you’re ready to upgrade, see this:

There are also guides for upgrading to 3.2.x and 3.4.x.

I see you installed react-freeze. You don’t appear to be using it, though.

  • I added/removed a few more dependencies.
  • I see you opted to use npm to manage the dependencies. There are some peer dependency issues with your dependencies, so to work around that I created a .npmrc file with the following contents:
legacy_peer_deps=true
  • After this I tried to create an Android build.
  • I got a complaint about metro.config.js not extending from Expo’s metro config. This seems mostly to be about extending from expo/metro-config instead of metro-config. I made some changes that I think will fix that.
  • Then it complained about missing wav files and icon for expo-notifications so I removed references to those from the plugins section of app.json.
  • It then crashed with the following error:
[RUN_GRADLEW] FAILURE: Build completed with 2 failures.
[RUN_GRADLEW] 1: Task failed with an exception.
[RUN_GRADLEW] -----------
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Execution failed for task ':app:mergeReleaseResources'.
[RUN_GRADLEW] > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
[RUN_GRADLEW]    > Android resource compilation failed
[RUN_GRADLEW]      ERROR:/private/var/folders/kj/rwm7htb51n18wlz4pbljb75w0000gn/T/eas-build-local-nodejs/49a4b0a9-d6f6-4eb0-a67b-e43775a17d23/build/android/app/build/generated/res/react/release/drawable-mdpi/src_img_close.png: AAPT: error: file failed to compile.

This is talking about a file called src/img/close.png. This sort of error is normally caused by a file that is not a PNG being named something.png. If I run the Unix file command on it, I see it’s actually a JPEG:

% file src/img/close.png
src/img/close.png: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 820x428, components 3

You have one of two options.

  1. Rename it to close.jpg and fix the references in the code
  2. Convert it to a PNG

I did the latter:

% file src/img/close.png
src/img/close.png: PNG image data, 820 x 428, 8-bit/color RGBA, non-interlaced

After that it builds. I have not tried running it.

I’ve created a pull request with my changes

Hey i pulled your request. i ran the npx expo start and it built but then threw an error.

`iOS Bundling complete 8421ms
 ERROR  TypeError: undefined is not a function, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes`

Saying that “Main” is not registered and undefined is not a function. What could be causing this error again?

I created a development build and opened the app in that.

I got the same error. It is to do with src/config/firebase.js:

It seems that your firebase changes are not enough to get it working.

What do you recommend i do, I am not too familiar with Firebase

Any Expo devs i that i could reach that are familiar with firebase upgrading?

Hi. I’ve not used Firebase before. You could possibly try asking somewhere like Stack Overflow or maybe see if there’s some sort of Firebase forum/Discord/etc.

Otherwise maybe try looking at the Firebase docs for a simple example and see if you can work out how to do that in your app.

The Expo website also has a Consultants page.

You could also see if anything on the Support page helps. Or the Expo Discord.

I had the exact same initial 2 Invariant Violation issues after I upgraded my expo project from 42 to 48. This thread helped identify Firebase as the source of the problems and now everything is working (thanks @wodin !)

As explained here, you have two choices when using Firebase. In my case, I already was using Firebase JS SDK and was not interested in using React Native Firebase.

Upgrading my version of Firebase JS SDK to version 9 solved the problem. However, it’s takes a little work if you’ve been using version 8 or earlier. To be clear, you can start with “Update imports to compat” and hold off on “Refactor to the modular style” until you verify it fixes the initial Invariant Violation issues.

Finally, on the expo side, I will mentioned that the depreciation of expo-app-loading may have been causing me problems. I removed it for now and will later figure out expo-splash-screen.

Thanks a million @wodin and @wokeupsober

1 Like

@theinternet Hey could you please give me a step by step breakdown of what you did. I am not really familiar with Firebase.

After this below step what do i do?

  1. run npm i firebase@9.22.2

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