Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Android has critical issues #3

Open
amerllica opened this issue Jun 6, 2020 · 10 comments
Open

Running Android has critical issues #3

amerllica opened this issue Jun 6, 2020 · 10 comments

Comments

@amerllica
Copy link

amerllica commented Jun 6, 2020

Under trying to run this test on Android I got these errors:

> Task :react-native-vlc-media-player:compileDebugJavaWithJavac

> Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
42 actionable tasks: 42 executed
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/amerllica/WebstormProjects/react-native-vlc-media-player-test/node_modules/react-native-vlc-media-player/android/src/main/java/com/yuanzhou/vlc/vlcplayer/ReactVlcPlayerView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/x86/libc++_shared.so'
@juliamsousa
Copy link

juliamsousa commented Jan 15, 2021

I've had trouble running on Android too. I got the following error:

Task :app:packageDebug FAILED

61 actionable tasks: 61 executed
Note: <my_path>\react-native-vlc-media-player-test\node_modules\react-native-vlc-media-player\android\src\main\java\com\yuanzhou\vlc\vlcplayer\ReactVlcPlayerView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: <my_path>\react-native-vlc-media-player-test\android\app\src\debug\java\com\vlctest\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:packageDebug'.

A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
java.lang.OutOfMemoryError (no error message)

** Edit: manage to run on android using the rn-63 branch **

@razorRun
Copy link
Owner

razorRun commented Jan 15, 2021 via email

@juliamsousa
Copy link

juliamsousa commented Jan 19, 2021

@razorRun i tried the test repo and the rn-63 branch was functioning perfectly. I tried to install the package in a brand new and unmodified react-native app and had many issues. I managed to install it by making some changes in the native modules. Here's what i did:

i added this to my android/app/build.gradle

` packagingOptions {

    pickFirst 'lib/x86/libc++_shared.so'

    pickFirst 'lib/arm64-v8a/libc++_shared.so'

    pickFirst 'lib/x86_64/libc++_shared.so'

    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}`

also:

`defaultConfig {
...

    multiDexEnabled true //Add this line

}`

and finally upgraded my minSDKVersion to 17 ( android/build.gradle):

`buildscript {

ext {

    buildToolsVersion = "29.0.2"

    minSdkVersion = 17

    compileSdkVersion = 29

    targetSdkVersion = 29
}

}`

After these modifications I didn't have any more issues with building and using the package.

@slaymantis
Copy link

slaymantis commented Sep 18, 2021

Same issue for me on Android
Works great on iOS though.
React 0.64.1

Dropping the minSdkVersion to 17 is not an option as other libraries rely on minSdkVersion 21

If I add the advice above but leave the minSdkVersion 21
The error is:

  • What went wrong:
    Execution failed for task ':app:packageDebug'.

A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
java.lang.OutOfMemoryError (no error message)

@razorRun
Copy link
Owner

razorRun commented Sep 18, 2021 via email

@slaymantis
Copy link

slaymantis commented Sep 22, 2021

Thanks, all in your own time when you ready :)
Just letting you know I also tried this test repo with react 0.63.4 but same error

  • What went wrong:
    Execution failed for task ':app:packageDebug'.

A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
java.lang.OutOfMemoryError (no error message)

But I did finally manage to get it working by adding the tip above

added this to android/gradle.properties
org.gradle.jvmargs=-Xmx4608m

added this to android/app/build.gradle
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}

defaultConfig {
...
multiDexEnabled true
}

dependencies {
implementation 'com.android.support:multidex:2.0.1'
}

Also not sure if it made a difference but I also rolled back to android studio 4.2.1 instead of 2021
And I installed oracle java instead of the homebrew one

@musadiq123
Copy link

@slaymantis Thank you so much you save my day
it work for me added this line
added this to android/gradle.properties
org.gradle.jvmargs=-Xmx4608m

@StevenGardnerGMJ
Copy link

a little change need:

implementation 'androidx.multidex:multidex:2.0.1'

@razorRun
Copy link
Owner

razorRun commented May 26, 2022 via email

@NandanSpeedshield
Copy link

Hi there,

Tested with react native 0.68,
react-native-vlc-media-player 1.0.41

I did the following changes to make it work:

In android/build.gradle
minSdkVersion =21

In android/app/build.gradle
add this

defaultConfig{
....
multiDexEnabled true

}

and
android {
.....
packagingOptions {

pickFirst 'lib/x86/libc++_shared.so'

pickFirst 'lib/arm64-v8a/libc++_shared.so'

pickFirst 'lib/x86_64/libc++_shared.so'

pickFirst 'lib/armeabi-v7a/libc++_shared.so'

}
}

in android/gradle.properties

add this
org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants