Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to use C++ library in Unity's Android build

Discussion in 'Android' started by namdao1227, Jul 19, 2023.

  1. namdao1227

    namdao1227

    Joined:
    May 10, 2020
    Posts:
    6
    I use C++ library to calculate some heavy task instead of using C#. It runs well on Editor but when I build to Android device, the build can not find the library. I tried my library on a new Android project from Android studio and I can run normally.
    Hope someone could help! Thanks in advance!
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,637
    How did you put your library into Unity project? Could you show layout and plugin settings?
     
  3. namdao1227

    namdao1227

    Joined:
    May 10, 2020
    Posts:
    6
    I built a library .aar in Android Studio and placed it in the "Plugins/Android" folder in Unity.
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,637
    Check if built apk file has your library in it.
    If it's only an .so file, you can put that file into Unity rather than .aar, that should work fine.