开发者

Problem with Android ndk

i wrote a c++ program with make file in JNI folder.and wrote a program with SDK.

i want to use C++ library , but when i use it and run it on emulator i have error.it said i should use force exit.

C++ source : (wipeSRC.cpp)

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <jni.h>

JNIEXPORT jint JNICALL Java_X_XX_WF_Simple(JNIEnv* env, jobject obj,jstring addrs)
{
    return 1;
}

make file :

开发者_如何学编程# makefile to pack JNI with AMR-NB native library
#

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := wipeLib
LOCAL_SRC_FILES := wipeSRC.cpp


include $(BUILD_SHARED_LIBRARY)

and in SDK with JAVA :

package X.XX;

import android.app.Activity;
import android.os.Bundle;

public class WF extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Simple("hello");
    }
    static
    {
        System.loadLibrary("wipeLib");
    }

    native int Simple(String addrs);

}


solved! i used windows 7 last.but know i try windows XP.

solution is that : use cygwin in windows 7 and copy library to win XP. then use XP to code in JAVA.at last problem will be solved.

i think it s better all programmers go to Linux. :D

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜