Another react-native project upgrade

9 February 2022
To 0.66.4
react-native

While the latest released version for react-native is 0.67.2, I upgraded the project that I am working on to 0.66.4 instead.

This is mainly due to some issues that I ran into that I decided not to spend too much time fixing it since 0.66.4 is sufficient for my use case.

In this blog, I will be sharing some of the issues that I ran into and the solutions for them. Hopefully someone might find it useful, and I can also refer to this blog in the near future if I need to upgrade other projects.


The issues

  1. folly

duplicate symbol 'folly::detail::str_to_bool(folly::Range<char const*>*)' in:
...
...

In my case, I need to do

pod update
pod install

Normally you need to run pod update after update react-native version

or in some cases

rm -rf Podfile.lock Pods/
pod install

if you thing you have messed up the Pods after upgrading to different react-native versions back and forth.

  1. #<WeakSet> could not be cloned

Then you might get this issue for any library.

error node_modules/react-native-vector-icons/lib/create-icon-set.js: #<WeakSet> could not be cloned.

error: node_modules/react-native-branch/src/branchUniversalObject.js: function (path) {
          return fn.call(state, path, state);
        } could not be cloned.
 BUNDLE  ./index.js

This has to do with babel, so you need to upgrade them as well.

yarn upgrade --dev @babel/core
yarn upgrade --dev @babel/runtime
  1. Android project could not resolve dependencies

Error:


FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalBetaRelease'.
> Could not resolve all artifacts for configuration ':app:betaDebugRuntimeClasspath'.
   > Could not resolve me.relex:photodraweeview:1.1.3.
     Required by:
         project :app > project :react-native-photo-view-ex
      > Skipped due to earlier error
   > Could not resolve org.webrtc:google-webrtc:1.0.+.
     Required by:
         project :app > project :react-native-twilio-video-webrtc
      > Skipped due to earlier error
   > Could not resolve com.yqritc:android-scalablevideoview:1.0.4.
     Required by:
         project :app > project :react-native-video
      > Skipped due to earlier error
   > Could not resolve com.getkeepsafe.relinker:relinker:1.3.1.
     Required by:
         project :app > project :react-native-twilio-video-webrtc > com.twilio:video-android:5.10.0
      > Skipped due to earlier error

Another error:

Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.yqritc:android-scalablevideoview:1.0.4.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/yqritc/android-scalablevideoview/1.0.4/android-scalablevideoview-1.0.4.pom

This is due to removal of the line jcenter() in android/build.gradle. Moving forward, JCenter will not be maintained.

So it is recommended to remove the depencencies to the repository.

Read more about the announcement here.

At the meantime, we have libraries that depends on JCenter and it's going to take time for maintainers to update the libraries.

So we can do this for now for the dependencies we need.

        jcenter() {
            content {
                includeModule("me.relex", "photodraweeview") // Could not resolve me.relex:photodraweeview:1.1.3.
                includeModule("org.webrtc", "google-webrtc") // Could not resolve org.webrtc:google-webrtc:1.0.+.
                includeModule("com.yqritc", "android-scalablevideoview") // Could not resolve com.yqritc:android-scalablevideoview:1.0.4.
                includeModule("com.getkeepsafe.relinker", "relinker") // Could not resolve com.getkeepsafe.relinker:relinker:1.3.1.
            }
        }

So now you get the idea of using includeModule.

That's all for the issues.

Hope that saves your precious time!

Cheers.