Android JNI why setChild() in ParentClass isnot available
<p>When I call testInterface(), setName() is OK, but setChild() as follows:</p>

<pre><code>E/AndroidRuntime(18708): java.lang.NoSuchMethodError: no non-static method "Lcom/***/TestParent;.setChild(Ljava/lang/Object;)V"
</code></pre>

<p><strong>JNI</strong></p>

<pre><code>JNIEXPORT jobject JNICALL Java_***_testInterface(
        JNIEnv * env, jobject thiz) {

    jclass parent_cls = env-&gt;FindClass("com/wkn/muscle/activity/TestParent");
    LOGD("testInterface 0");

    jmethodID parent_mid = env-&gt;GetMethodID(parent_cls, "&lt;init&gt;", "()V");
    LOGD("testInterface 1");

    jobject parent_obj = env-&gt;NewObject(parent_cls, parent_mid);
    LOGD("testInterface 2");

    jstring str_parent = env-&gt;NewStringUTF("Parent_from_Native");
    LOGD("testInterface 3");

    jmethodID parent_set_name = env-&gt;GetMethodID(parent_cls, "setName",
            "(Ljava/lang/String;)V");
    LOGD("testInterface 4");

    env-&gt;CallVoidMethod(parent_obj, parent_set_name, str_parent);
    LOGD("testInterface 5");

    jclass child_cls = env-&gt;FindClass("com/wkn/muscle/activity/TestChild");
    LOGD("testInterface 6");

    jmethodID child_mid = env-&gt;GetMethodID(child_cls, "&lt;init&gt;", "()V");
    LOGD("testInterface 7");

    jobject child_obj = env-&gt;NewObject(child_cls, child_mid);
    LOGD("testInterface 8");

    jstring str_child = env-&gt;NewStringUTF("Child_from_Native");
    LOGD("testInterface 9");

    jmethodID child_set_name = env-&gt;GetMethodID(child_cls, "setName",
            "(Ljava/lang/String;)V");
    LOGD("testInterface 10");

    env-&gt;CallVoidMethod(child_obj, child_set_name, str_child);
    LOGD("testInterface 11");

    jmethodID parent_set_child = env-&gt;GetMethodID(parent_cls, "setChild",
            "(Ljava/lang/Object;)V");
    LOGD("testInterface 12");

    env-&gt;CallVoidMethod(parent_obj, parent_set_child, child_obj);

    LOGD("testInterface 13");
    return parent_obj;
}
</code></pre>

<p><strong>Java:</strong></p>

<pre><code>public class TestParent {

    private TestChild child;

    public TestParent(){

    }

    public String getName(){
        return this.name;
    }

    public void setName(String name){
        this.name = name;
    }

    public TestChild getChild(){
        return this.child;
    }

    public void setChild(TestChild child){
        this.child = child;
    }
}

public class TestChild {

    private String name;

    public TestChild(){
    }

    public String getName(){
        return this.name;
    }

    public void setName(String name){
        this.name = name;
    }
}
</code></pre>