LoadClass using DexClassLoader : Didn't find class on path

MobileTeam.1430MobileTeam.1430 USMember
edited April 2015 in Xamarin.Android


I'm having a problem in loading class using DexClassLoader.
I want to load the "com.example.dex.lib.LibraryProvider" class.
I need your help on this problem. Thanks

Here's my code:

void button_Click(object sender, EventArgs e)
        Java.IO.File dexPath = new Java.IO.File(GetDir("dex", FileCreationMode.Private), "secondary_dex.jar");
        Java.IO.File optimizedDirectory = GetDir("outdex", FileCreationMode.Private);

        string path = "/data/data/ReadJarFile.ReadJarFile/app_dex/secondary_dex.jar";

        PathClassLoader loader = new PathClassLoader(path, this.ApplicationContext.ClassLoader.Parent);
        DexClassLoader cl = new DexClassLoader(dexPath.AbsolutePath, optimizedDirectory.AbsolutePath, null, loader);

        var result = cl.LoadClass("com.example.dex.lib.LibraryProvider");

    private void prepareDex(string path)
        using (var asset = Assets.Open("secondary_dex.jar"))
            using (var dest = File.Create(path))


Sign In or Register to comment.