DllNotFoundException in Unity android app

Hi, I am currently using Cryptlex in a unity application. I added the libLexActivator.so into the project and added the GitHub - cryptlex/lexactivator-dotnet: LexActivator API wrapper for .NET (licensing library).

Getting following message:

11:40:38.493UTC: GameInitialization:LicenseManager - Exception: System.DllNotFoundException: LexActivator
  at (wrapper managed-to-native) Cryptlex.LexActivatorNative.SetProductFile(string)
  at Cryptlex.LexActivator.SetProductFile (System.String filePath) [0x0000b] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Plugins\LexActivator\API\LexActivator.cs:37 
  at Cryptlex.CryptlexService.SetProductFile (System.String filePath) [0x00001] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Scripts\Runtime\Tools\License Tool\Scripts\ICryptlexService.cs:544 
  at LicenseManager.SetProductFileAndVersionGUIDv3 (LicenseManager+CryptlexProduct cryptlexProduct) [0x00059] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Scripts\Runtime\Tools\License Tool\Scripts\LicenseManager.cs:136 
  at LicenseManager.IsProductGenuineV3 (LicenseManager+CryptlexProduct cryptlexProduct) [0x00038] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Scripts\Runtime\Tools\License Tool\Scripts\LicenseManager.cs:198 
  at LicenseManager.IsProductGenuine (LicenseManager+CryptlexProduct cryptlexProduct) [0x0001d] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Scripts\Runtime\Tools\License Tool\Scripts\LicenseManager.cs:151 
  at System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0002c] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at LicenseManager.CheckLicense () [0x00002] in C:\Users\Admin\wkspaces\<a game>New\<a game>\Assets\Scripts\Runtime\Tools\License Tool\Scripts\LicenseManager.cs:91 
UnityEngine.Debug:LogError(Object)
Debug:LogError(Object, Object) (at Packages/<a game company>Utilities/Scripts/ExtendedDebug.cs:67)
Logger:LogError(String) (at Assets/Scripts/Runtime/Util/Logger.cs:26)
LicenseManager:CheckLicense() (at Assets/Scripts/Runtime/Tools/License Tool/Scripts/LicenseManager.cs:96)
LicenseManager:Start() (at Assets/Scripts/Runtime/Tools/License Tool/Scripts/LicenseManager.cs:77)

Libs are in
Assets/Plugins/Android/libs/arm64-v8a/libLexActivator.so
and
Assets/Plugins/Android/libs/armeabi-v7a/libLexActivator.so

Has anyone an idea?

Hi,

How did you add this project? You don’t have to include this code in your app, nor you have to manually include the DLLs and .so files.

You just have to install the nuget package and it will handle the rest.

Does the nuget package also handle the android integration?

We imported it via nuget for unity now. Still not working:

16:55:11.814UTC: GameInitialization:LicenseManager - Exception: System.DllNotFoundException: LexActivator
  at (wrapper managed-to-native) Cryptlex.LexActivatorNative.SetProductFile(string)
  at Cryptlex.LexActivator.SetProductFile (System.String filePath) [0x0000f] in <71174367958147759f59003818bb2d35>:0 
  at Cryptlex.CryptlexService.SetProductFile (System.String filePath) [0x00001] in

We were creating a whole new clean Unity project now, added NuGet for Unity and imported Cryptlex. We are running 2019.4.12f on build platform Android.

DllNotFoundException: LexActivator
Cryptlex.LexActivator.SetProductFile (System.String filePath) (at <4d90ce4b68b94b7b87033582a8ac55ff>:0)
Test.SetProductFileAndVersionGUIDv3 (CryptlexProduct cryptlexProduct) (at Assets/Test.cs:314)
Test.IsProductGenuineV3 (CryptlexProduct cryptlexProduct) (at Assets/Test.cs:353)
Test.CheckLicense () (at Assets/Test.cs:398)
UnityEngine.Events.InvokableCall.Invoke () (at <a4546799a4ab426788e4204c69507924>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <a4546799a4ab426788e4204c69507924>:0)
GenericEventEditorTriggerEditor.OnInspectorGUI () (at Assets/Scenes/Editor/GenericEventEditorTriggerEditor.cs:23)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Still the dll is not recognized. This is really urgent, do you maybe have a developer for me to talk to, so we can work this out?

The nuget package supports following platforms:

Windows, MacOS and Linux.

In case of Android we offer C library for NDK, and Java AAR package.

We will try adding Android support in the nuget package and see if it works.

1 Like

Thank you very much! Can you give an approximate eta?

Implementation will be simple to just update the nuspec file:

and add the following line:

<file src="runtimes\android-arm64\native\*.so" target="runtimes\android-arm64\native" />

But our C library requires JNIEnv to be passed to the library. In the Java library we get JNIEnv from JNA:

I am not sure how one would get it in dotnet. Any suggestions to speed this up?