JNI + ClassNotFoundException

JulianoJuliano BRMember ✭✭
edited January 2014 in Xamarin.Android

Hello,
I'm trying to accomplish something crazy here.
I have a component (written in java) that i'm trying to integrate with Xamarin using JNI. First i made a test in java:

package com.example.com.jfl.cuboseclipse;

import java.util.Calendar;
import java.util.TimeZone;

public class testeIntegracao 
{
    public int Estatico()
    {
        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); 

        return cal.get(Calendar.SECOND);
    }

}

Then in my component, i used this to create the class object, and call the method:

AndroidJavaObject Obj = new AndroidJavaObject("testeIntegracao");
Obj.Call<int>("Estatico");

Simple. Worked.

So now i'm trying to do the same thing, but changing the java class (testeIntegracao) with a C# class in Xamarin:

public class testeIntegracao
{
    public int Estatico()
    {
        return 1;
    }
}

But the component returns me ClassNotFoundException.
After digging a little, the only thing that i discovered is: if i change the component code to search the MainActivity class (the basic activity), it works. But after that nothing more (create a object of class, get an object inside this class, create a object of a class inside the class, etc.).

Anyone have an idea ?

Thanks !

Sign In or Register to comment.