Skip to content

VLC + realm Library conflicts #1640

Closed
Closed
@mjliu

Description

@mjliu

@beeender
use realm + VLC ,some devices crash. the error message :

org.videolan.vlc E/VLC/LibVLC﹕ Can't load vlcjni library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.videolan.vlc-2/base.apk"],nativeLibraryDirectories=[/data/app/org.videolan.vlc-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libvlcjni.so"

VLC
336787fb-bf1b-4fbe-8e16-75c991621f5e

Activity

cwangzh

cwangzh commented on Oct 22, 2015

@cwangzh

I also want to know

beeender

beeender commented on Oct 22, 2015

@beeender
Contributor

@mjliu

  1. Which devices have this issue? Only arm64 chipset devices? What are the Android version of those devices?
  2. Which Realm version are you using?
  3. Does VLC lib have so files for all kinds of platforms?
  4. How did you load the vlc so file and when? Before the first time init Realm or after?
  5. Can you reproduce this issue?
cwangzh

cwangzh commented on Oct 22, 2015

@cwangzh

1.samsung s6 、huawei p8 and so on. Only arm64 chipset devices! above Android 5.0 .
2.0.81.1
3.Yes
https://wiki.videolan.org/AndroidCompile/#Devices
Devices
Find the ABI for the target device.
For a normal (2012-2015 consumer phone or tablet) device (e.g. Cortex-A8 or Cortex-A9)
armeabi-v7a
For a Tegra2 device (no NEON)
armeabi-v7a
For an ARMv6 device
armeabi
For an ARMv6 device that does not support FPU
armeabi-nofpu
For an ARMv5 device or the Android Emulator
armeabi-v5
For a x86 device (e.g. Android-x86, Google TV, Logitech TV, Android x86 smartphones, etc)
x86
For a MIPS device (i.e. Ainol Novo tablets):
mips
This value must be passed to the compile.sh script

4.before

5.Yes,Each time will now

@beeender

beeender

beeender commented on Oct 22, 2015

@beeender
Contributor

@cwangkkb @mjliu I think the problem is vlc doesn't supply a arm64 so file. In this situation, ASOP should just copy Realm's arm64 so and fallback to copy vlc's armeabi-v7a to app's lib directory.

can you please list all the files recursively in the phone's /data/app/org.videolan.vlc-2/lib/ directory which has this problem? It seems to be an AOSP bug...

dalinaum

dalinaum commented on Oct 22, 2015

@dalinaum
Contributor

Hello @cwangkkb @mjliu

I just built vlc. There is no aarch64 (arm64) so files.

I think you might encounter Can't load vlcjni library: java.lang.UnsatisfiedLinkError without Realm. Did you run your app on arm64 devices before?

$ find . -name "*.so"
./android-libs/arm-linux-androideabi/libbinder.so
./android-libs/arm-linux-androideabi/libcutils.so
./android-libs/arm-linux-androideabi/libhardware.so
./android-libs/arm-linux-androideabi/libmedia.so
./android-libs/arm-linux-androideabi/libstagefright.so
./android-libs/arm-linux-androideabi/libui.so
./android-libs/arm-linux-androideabi/libutils.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libanw.10.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libanw.13.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libanw.14.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libanw.18.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libanw.21.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libiomx.10.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libiomx.13.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libiomx.14.so
./libvlc/build/intermediates/bundles/release/jni/armeabi-v7a/libvlcjni.so
./libvlc/jni/libs/armeabi-v7a/libanw.10.so
./libvlc/jni/libs/armeabi-v7a/libanw.13.so
./libvlc/jni/libs/armeabi-v7a/libanw.14.so
./libvlc/jni/libs/armeabi-v7a/libanw.18.so
./libvlc/jni/libs/armeabi-v7a/libanw.21.so
./libvlc/jni/libs/armeabi-v7a/libiomx.10.so
./libvlc/jni/libs/armeabi-v7a/libiomx.13.so
./libvlc/jni/libs/armeabi-v7a/libiomx.14.so
./libvlc/jni/libs/armeabi-v7a/libvlcjni.so
./libvlc/jni/obj/local/armeabi-v7a/libanw.10.so
./libvlc/jni/obj/local/armeabi-v7a/libanw.13.so
./libvlc/jni/obj/local/armeabi-v7a/libanw.14.so
./libvlc/jni/obj/local/armeabi-v7a/libanw.18.so
./libvlc/jni/obj/local/armeabi-v7a/libanw.21.so
./libvlc/jni/obj/local/armeabi-v7a/libiomx.10.so
./libvlc/jni/obj/local/armeabi-v7a/libiomx.13.so
./libvlc/jni/obj/local/armeabi-v7a/libiomx.14.so
./libvlc/jni/obj/local/armeabi-v7a/libvlcjni.so
./vlc/contrib/arm-linux-androideabi/lib/preloadable_libiconv.so
./vlc/contrib/contrib-android-arm-linux-androideabi/iconv/preload/.libs/libiconv.so
./vlc/contrib/contrib-android-arm-linux-androideabi/iconv/preload/preloadable_libiconv.so
./vlc/extras/tools/cmake/Source/kwsys/libcmsysTestDynload.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libanw.10.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libanw.13.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libanw.14.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libanw.18.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libanw.21.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libiomx.10.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libiomx.13.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libiomx.14.so
./vlc-android/build/intermediates/exploded-aar/vlc-android/libvlc/unspecified/jni/armeabi-v7a/libvlcjni.so
mjliu

mjliu commented on Oct 22, 2015

@mjliu
Author

@dalinaum
without realm the VLC is ok. these devices have no that error

cwangzh

cwangzh commented on Oct 22, 2015

@cwangzh

@dalinaum
I run my app on arm64 devices before without Realm,hasn't problem.
after add realm jar lead to Can't load vlcjni library: java.lang.UnsatisfiedLinkError !

Vlc is no aarch64 (arm64) so files.
I run his demo normal. but add realm throw exceptions!!

Can you try it?

mjliu

mjliu commented on Oct 22, 2015

@mjliu
Author

@beeender
I can fetch realm's arm64 so and add this to the vlc anrmeabi-v7a .
but I don't know how to build a realm Jar without arm64 so . there has error multiple-dex

beeender

beeender commented on Oct 22, 2015

@beeender
Contributor

@mjliu
I think there is a bug in AOSP, the system failed to fall back to choose a non-64bit version of vlc when other so libs do have arm64 version.

See doc here:
https://realm.io/docs/java/latest/#couldnt-load-librealm-jniso Doc updated.

Simply exclude the .so you don't want in gradle like:

android {
    //...
    packagingOptions {
        exclude "lib/arm64-v8a/librealm-jni.so"
    }
    //...
}

----UPDATED Nov.17th, NO NEED TO USE BELOW----
One solution is, you can remove the Realm's arm64 so from your apk file and try again. Then the system will just choose non-arm64 so for both, vlc and Realm.

To build realm without arm64 so, just modify the realm-jni/build.gradle as

def targets = [
    new Target( name:'arm', jniFolder:'armeabi', toolchain:toolchains.find{it.name == 'arm'}, cflags:[ '-mthumb' ] ),
    new Target( name:'arm-v7a', jniFolder:'armeabi-v7a', toolchain:toolchains.find{it.name == 'arm'}, cflags:[ '-mthumb', '-march=armv7-a', '-mfloat-abi=softfp', '-mfpu=vfpv3-d16' ] ),
    //new Target( name:'arm64', jniFolder:'arm64-v8a', toolchain:toolchains.find{it.name == 'arm64'}, cflags:[] ),
    new Target( name:'mips', jniFolder:'mips', toolchain:toolchains.find{it.name == 'mips'}, cflags:[] ),
    new Target( name:'x86', jniFolder:'x86', toolchain:toolchains.find{it.name == 'x86'}, cflags:[] ),
    new Target( name:'x86_64', jniFolder:'x86_64', toolchain:toolchains.find{it.name == 'x86_64'}, cflags:[] )
]

Then run ./gradlew androidJar

kneth

kneth commented on Oct 22, 2015

@kneth
Contributor

@mjliu Can you confirm that solution proposed by @beeender works for you?

mjliu

mjliu commented on Oct 22, 2015

@mjliu
Author

@kneth
building realm jar. the net is too slow

mjliu

mjliu commented on Oct 22, 2015

@mjliu
Author

@beeender @kneth
this issue is resolved by @beeender 's solution.
thanks

we delete the x64 so.
1、what the impact of app without the realm x64 ?
2、have some other hidden troubles ?

1 remaining item

cmelchior

cmelchior commented on Oct 22, 2015

@cmelchior
Contributor

We should consider adding a section about this to our website. This problem as popped up quite a few times already.

leolxmy

leolxmy commented on Oct 28, 2015

@leolxmy

@mjliu Have you solved it?

mjliu

mjliu commented on Oct 28, 2015

@mjliu
Author

@leolxmy
Yes have solved

leolxmy

leolxmy commented on Oct 28, 2015

@leolxmy

How to solve?

leolxmy

leolxmy commented on Oct 28, 2015

@leolxmy

@mjliu How to solve?

mjliu

mjliu commented on Oct 28, 2015

@mjliu
Author

@leolxmy

To build realm without arm64 so, just
modify the realm-jni/build.gradle as

def targets = [
new Target( name:'arm', jniFolder:'armeabi', toolchain:toolchains.find{it.name == 'arm'}, cflags:[ '-mthumb' ] ),
new Target( name:'arm-v7a', jniFolder:'armeabi-v7a', toolchain:toolchains.find{it.name == 'arm'}, cflags:[ '-mthumb', '-march=armv7-a', '-mfloat-abi=softfp', '-mfpu=vfpv3-d16' ] ),
//new Target( name:'arm64', jniFolder:'arm64-v8a', toolchain:toolchains.find{it.name == 'arm64'}, cflags:[] ),
new Target( name:'mips', jniFolder:'mips', toolchain:toolchains.find{it.name == 'mips'}, cflags:[] ),
new Target( name:'x86', jniFolder:'x86', toolchain:toolchains.find{it.name == 'x86'}, cflags:[] ),
new Target( name:'x86_64', jniFolder:'x86_64', toolchain:toolchains.find{it.name == 'x86_64'}, cflags:[] )
]
Then run ./gradlew androidJar

leolxmy

leolxmy commented on Oct 28, 2015

@leolxmy

@mjliu Can you give me a demo? I'm not quite understand

beeender

beeender commented on Oct 28, 2015

@beeender
Contributor

@leolxmy Or you can just use our released jar file, and open it with normal archive tools, remove the arm64 directory. jar file is just a zip file.

beeender

beeender commented on Nov 4, 2015

@beeender
Contributor
locked as resolved and limited conversation to collaborators on Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dalinaum@cmelchior@beeender@kneth@cwangzh

        Issue actions

          VLC + realm Library conflicts · Issue #1640 · realm/realm-java