• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Aw0k3n · Feb 03, 2019 at 12:37 PM · androidunity 5augmented-realitynative plugin

NativePlugin c++ Android sample and self build pcl not loading,Native Plugins c++ "dll not found"

Hello unity-community,

i got some trouble with native Plugins. I compiled the pointCloudLib (PCL) into a static and dynamic lib. Both of them can't be found when calling them like your documentation descripes. (https://docs.unity3d.com/Manual/NativePlugins.html) Tryed import with:

 [DllImport("libnative.so")]
 private static extern float add(float x, float y);

 [DllImport("native")]
 private static extern float add(float x, float y);

With both i get same result:

 System DllNotFoundException: libnative.so / native
 at (wrapper managed-to-native) CallNativeCode: add(single,single)
 at CallNativeCode._callAdd (Single x, Single y) [0x00000] in <filename unkown>:0
 at Thesis.Scripts.AppController.Update () [0x00000] in <filename unkown>:0

File location of Plugins are \Assets\Plugins\Android

Even your sample AndroidNativePlugin-file doesn't work for me. (https://docs.unity3d.com/Manual/AndroidNativePlugins.html) Maybe I'm doing something wrong. I tryed with followed Unity-versions:

  • 2018.3.0f2

  • 2018.2.15f

  • 2017.4.17f1

Thanks in edvance for helping me

Yours sincerely

Stefan

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by madleen_unity · Feb 27, 2019 at 10:53 AM

Hi,

The issue seems to be that the .so file in the package is out of date.
Here are the proposed steps to recompile the .so file:
You will need to use the NDK for this but it is a requirement for native plugin use so you should already have this installed.

Follow the steps as described in the 'Native plug-in Sample' to set up the test project.

  1. Download the the zip file.

  2. Extract the AndroidNativePlugin.unitypackage file.

  3. Open the Unity Editor.

  4. Create a new Project.

  5. In the new project click Assets > Import Package & Custom Package.

  6. In the Import Package file dialog, navigate to the location in which you extracted the file and select it.

    Next you will need to use the NDK build command to rebuild the libnative.so

  7. Open a command prompt and navigate to: \Assets\Plugins\Android\src

  8. Run the following command: \ndk-build.cmd NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk This may warn you that the requested android NDK version is not supported but it will just use the minimum supported version for your installed NDK. This will produce a new libnative.so file.

  9. Copy the new libnative.so file from: \Assets\Plugins\Android\src\libs\armeabi to \Assets\Plugins\Android
    This will replace the old libnative.so file which is already in that location and this got rid of the exception.

    I have notified the developers to update the Manual with a recompiled .so file, but I hope until then the steps mentioned above will help you out!

Comment
Aw0k3n

People who like this

1 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Aw0k3n · Mar 05, 2019 at 05:10 PM

Hello and thanks you for your answer,

I followed your instructions. Had to make a change in the Application.mk File

 ABI := armeabi 

to

 ABI := armeabi-v7a

After this change and running your command i got a new .so file. Now its working perfectly fine! Thanks again!

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

227 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

'Failed to create agent' error made even after building the NavMesh in real time - AR Foundation 0 Answers

Unity ARCore Unable to extract resources needed by IL2CPP 0 Answers

Android Unity, Screen Recording and MediaProjection APIs - UnityPlayerActivity hang. 0 Answers

Normal map is not working with Unity 5 when Low-level Native Plugin Interface is used 0 Answers

Continue developing in Android Studio 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges