Plugin system, secondary AppDomain can't find libjvm.so

Hi.

We're trying to create a plugin system where we create a secondary AppDomain and there we load .net assemblies to be able to load/unload those as needed.

Everything works as expected unless we call any function of the Android system from the secondary domain, in that moment an exception is raised telling us that libjvm.so can't be found.

If I load the same library dinamically on the root domain then the library works as expected, so I assume there's some difference between my newly created domain and the new one.

This is the code to create the domain, really simple:

var current = AppDomain.CurrentDomain; AppDomain newDomain = AppDomain.CreateDomain(ApplicationName, current.Evidence, current.SetupInformation);

And this is the code for the test library:

using Android.Util;
using FTA1769_ApplicationLoader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ApplicationTest
{
    public class ApplicationTest : IApplicationChannel
    {
        public event EventHandler<ApplicationChannelEventArgs> ApplicationCommand;

        public int SendCommandToApp(int Command, string Arguments)
        {

            Log.Info("FTA", $"Something");

            if (ApplicationCommand != null)
            {
                ApplicationCommand(null, new ApplicationChannelEventArgs { Command = Command, Arguments = Arguments });
                return 1;
            }

            return -1;
        }
    }
}

If I remove the call to Log.Info everything works.

Any ideas?

Sign In or Register to comment.