react-native-vlc-media-player icon indicating copy to clipboard operation
react-native-vlc-media-player copied to clipboard

incompatible with Gradle 8.0

Open raajjemv opened this issue 3 years ago • 5 comments

Screen Shot 2022-02-16 at 11 13 16 PM

react-native: 0.67.2

it works perfectly with ios.

raajjemv avatar Feb 16 '22 18:02 raajjemv

Any Updates on that? My App works on iOS but Android is not working at all

youcci avatar Apr 26 '22 12:04 youcci

@raajjemv Hi if this is still a problem for you then the author has posted the fix. As the error stated, libc++_shared.so was found on 2 files.

This snippet was included in the README to remove one of the duplicate libc++_shared.so, on jetified-react-native file.

tasks.whenTaskAdded((tas -> {
    // when task is 'mergeLocalDebugNativeLibs' or 'mergeLocalReleaseNativeLibs'
    if (tas.name.contains("merge") && tas.name.contains("NativeLibs")) {
        tasks.named(tas.name) {it
            doFirst {
                java.nio.file.Path notNeededDirectory = it.externalLibNativeLibs
                        .getFiles()
                        .stream()
                        .filter(file -> file.toString().contains("jetified-react-native"))
                        .findAny()
                        .orElse(null)
                        .toPath();
                Files.walk(notNeededDirectory).forEach(file -> {
                    if (file.toString().contains("libc++_shared.so")) {
                        Files.delete(file);
                    }
                });
            }
        }
    }
}))

Be mindful though as on the latest react-native version the file is not named jetified-react-native anymore ~~if you enabled hermes.~~ It is jetified-react-android instead.

longphung avatar Mar 22 '23 13:03 longphung

I get the following error when adding this block of code to android/app/build.gradle:

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not get unknown property 'Files' for task ':app:mergeDebugNativeLibs' of type com.android.build.gradle.internal.tasks.MergeNativeLibsTask.

Tried to figure it out by myself but my Java and Groovy skills are lacking.

Using react-native 0.70.6

Any ideas?

i also get a syntax error in the editor but i'm not sure it is linked: image

racedaemon avatar Mar 23 '23 10:03 racedaemon

You need to import Files. Add this line to the top of your build.gradle:

import java.nio.file.Files

longphung avatar Mar 23 '23 22:03 longphung