Skip to content

Using Android Library in Unity 2022.3.62f2 #2603

Open

Description

@eeease

Thanks for this project, it's very easy to use on Windows and Mac.

I am having a lot of trouble trying to use MediaInfoLib in an Android apk built from Unity 2022.3.62f1.
We have it working on Windows and macOS (thanks for the easily accessible DLL files), but I can't access the library when I build an .apk.

I've downloaded the MediaInfo APK from mediaarea.net and it works great on my deployed device - I can choose a file and see all of the metadata I would want in a quick, clean package.

What I've tried:

  1. Using the libmediainfo.so library file from the MediaInfo.apk. I downloaded the apk, renamed it to a .zip, extracted it, and placed the libmediainfo.so file in my project, similar to how I've added the Windows/Mac DLLs. I get an "Unable to load MediaInfo library" error when I try to use the Get function in MediaInfoDLL.cs.
Image
  1. Using older Android library files from olegazyx's repo.
  2. Using a newer Android library (.aar) file from marlboro-advance's repo. This one seems promising but I have innumerable incompatibilities. The main issue seems to be between Unity's maximum JDK (Java 11, 55) and the .aar being built with Java 21, 65.

Has anyone gotten MediaInfoLib to run in an Android apk built from Unity? Any advice would be greatly appreciated. I'm looking into other metadata options (TagLibSharp, ex), but I would really like to use MediaInfoLib for all three platforms (Windows, Mac, Android).

Thanks again!

Activity

  1. cjee21 commented on May 14, 2026

    @cjee21
    Contributor

    There is a PR for building an Android AAR that exposes both JNI/Kotlin interface as well as C interface: #2592

    It is not tested yet for using the C API. Would be great if developers who want to use the library can provide feedback on what they need and what works best etc.

    FYI, the .so from official Android app won't work for your case as it is a special build with minimum features needed for the official Android app as well as only exposing a JNI interface.

  2. cjee21 commented on May 14, 2026

    @cjee21
    Contributor

    Since you managed to get it working for Windows, maybe you can help #2147 and #2424 as well.

  3. eeease commented on May 15, 2026

    @eeease
    Author

    Thank you!
    Using that PR, I was able to build an .aar file that works with Unity2022.3.62f1 -> Android build.
    Even better, the library works from the apk!

    Within the next few days, I will update my steps on the PR for posterity + feedback. I'll try my best to answer the other issues, too. Happy to help where I can.

  4. cjee21 commented on May 16, 2026

    @cjee21
    Contributor

    I just noticed, for your project, you do not need to include MediaInfo_InfoTip stuff, that is for showing tooltips in Windows File Explorer.

  5. JeromeMartinez commented on May 16, 2026

    @JeromeMartinez
    Member

    Within the next few days, I will update my steps on the PR for posterity + feedback.

    If you are motivated, I am interested in an example, copying https://github.com/MediaArea/MediaInfoLib/blob/master/Source/Example/HowToUse.cpp (project files to be put in https://github.com/MediaArea/MediaInfoLib/tree/master/Project )

    I'll try my best to answer the other issues, too. Happy to help where I can.

    It would be great because on our side we are not users and don't know much here.

  6. cjee21 commented on May 16, 2026

    @cjee21
    Contributor

    FYI I have rebased the PR on release version 26.05 as well as make some tweaks to get the CMake part to work (so that it can be used by apps that want to access the library from native/C/C++ code).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions