Hi all,
Edit : Now that I am using the android device instead of an emulator I am getting system.entrypointnotfoundexception
I am trying to call a simple native function (C++) from Unity3D. I have done the following:
Placed the libMSDKWrapper.so in Assets->Plugins->Android
This is my C# code
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class facebooktest : MonoBehaviour {
[DllImport (“MSDKWrapper”)]
private static extern long getContextNative();
void Start () {
Debug.Log(“Hello, World!”);
long context = getContextNative(); // ← Exception thrown here
Debug.Log(context);
}
}
I am getting the following exception:
system.entrypointnotfoundexception at [0x00000] in :0
I used the same libMSDKWrapper.so using java using the command
System.loadLibrary(“MSDKWrapper”);
and I was able to access and use the getContextNative() method.
Edit 1: I unzipped the contents of the apk and found that libMSDKWrapper.so file is present in test.apk/lib/armeabi-v7a
Edit 2: Here are the logcat logs.
03-25 11:40:17.543: D/dalvikvm(26176): Trying to load lib /data/data/com.disney.citygirl.goo/lib/libMSDKWrapper.so 0x41566348
03-25 11:40:17.568: D/MSDK(26176): Register Provider: SN_COMMUNITY
03-25 11:40:17.568: D/MSDK(26176): Register Provider: SN_FACEBOOK
03-25 11:40:17.568: D/dalvikvm(26176): Added shared lib /data/data/com.disney.citygirl.goo/lib/libMSDKWrapper.so 0x41566348
03-25 11:40:17.568: I/MSDK(26176): JNI_OnLoad called
03-25 11:40:17.573: D/dalvikvm(26176): Trying to load lib /data/data/com.disney.citygirl.goo/lib/libMSDKWrapper.so 0x41566348
03-25 11:40:17.573: D/dalvikvm(26176): Shared lib ‘/data/data/com.disney.citygirl.goo/lib/libMSDKWrapper.so’ already loaded in same CL 0x41566348
03-25 11:40:17.598: I/Unity(26176): System.EntryPointNotFoundException: getContextNative
03-25 11:40:17.598: I/Unity(26176): at (wrapper managed-to-native) SocialAccess:getContextNative ()
03-25 11:40:17.598: I/Unity(26176): at SocialAccess.OnClick () [0x00000] in :0
03-25 11:40:17.598: I/Unity(26176):
03-25 11:40:17.598: I/Unity(26176): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)