Skip to content

Expo SDK 54 / RN 0.81 – Fix \withGradleTasks.js\ anchorΒ #280

@devpedrofurquim

Description

@devpedrofurquim

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch `react-native-vlc-media-player@1.0.94` for the project I'm working on.


Problem

In Expo SDK 54 (React Native 0.81), the Gradle script in `android/app/build.gradle` no longer contains:

```gradle
applyNativeModulesAppBuildGradle(project)
```

Instead, it now uses:

```gradle
apply plugin: "com.facebook.react"
```

Because of this, the current anchor regex in
`expo/android/withGradleTasks.js` does not match, and the Gradle task that removes duplicate `libc++_shared.so` never gets injected. This can lead to duplicate symbol build errors.


Solution

Here is the diff that solved my problem:

```diff
diff --git a/node_modules/react-native-vlc-media-player/expo/android/withGradleTasks.js b/node_modules/react-native-vlc-media-player/expo/android/withGradleTasks.js
index 46becf5..fd2e131 100644
--- a/node_modules/react-native-vlc-media-player/expo/android/withGradleTasks.js
+++ b/node_modules/react-native-vlc-media-player/expo/android/withGradleTasks.js
@@ -36,11 +36,11 @@ const withGradleTasks = (config, options) => {
}
return withAppBuildGradle(config, (config) => {
const newCode = generateCode.mergeContents({

  •        tag: "withVlcMediaPlayer",
    
  •   tag: "withVlcMediaPlayer",
           src: config.modResults.contents,
           newSrc: resolveAppGradleString(options),
    
  •        anchor: /applyNativeModulesAppBuildGradle\\(project\\)/i,
    
  •        offset: 2,
    
  •        anchor: /apply plugin: "com.facebook.react"/i,
    
  •        offset: 1,
           comment: "//",
       });
    

```


This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions