public class CplusGraphics {
static{
System.out.println("方法被调用之前--------------");
System.loadLibrary("ShapeRead");
System.out.println("方法被调用--------------");
}
public static native int GetShpType();
} /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_graphics_base_CplusGraphics */ #ifndef _Included_com_graphics_base_CplusGraphics
#define _Included_com_graphics_base_CplusGraphics
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_graphics_base_CplusGraphics
* Method: GetShpType
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_graphics_base_CplusGraphics_GetShpType
(JNIEnv *, jobject); #ifdef __cplusplus
}
#endif
#endif
#include "com_graphics_base_CplusGraphics.h"
#include <stdlib.h> #ifndef _Included_com_fileText_fileRead
#define _Included_com_fileText_fileRead
#ifdef __cplusplus extern "C" {
#endif
//jobject arraylist; JNIEXPORT jint JNICALL Java_com_graphics_base_CplusGraphics_GetShpType
(JNIEnv *env, jobject obj) /*
* Class: CplusGraphics
* Method: SetShpType
* Signature: (I)V
*/
{
int i = 100;
jint type = i;
return type;
} #ifdef __cplusplus
}
#endif
#endif //其他类里面调用
System.out.println(CplusGraphics.GetShpType());
然后编译没问题,android模拟器里面运行程序,屏幕会卡住。
而
System.out.println("方法被调用之前--------------");
System.loadLibrary("ShapeRead");
System.out.println("方法被调用--------------");
中只有第一句输出了。就卡在第二句java语句上了。 求各位大大帮忙看看哪里错了。
static{
System.out.println("方法被调用之前--------------");
System.loadLibrary("ShapeRead");
System.out.println("方法被调用--------------");
}
public static native int GetShpType();
} /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_graphics_base_CplusGraphics */ #ifndef _Included_com_graphics_base_CplusGraphics
#define _Included_com_graphics_base_CplusGraphics
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_graphics_base_CplusGraphics
* Method: GetShpType
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_graphics_base_CplusGraphics_GetShpType
(JNIEnv *, jobject); #ifdef __cplusplus
}
#endif
#endif
#include "com_graphics_base_CplusGraphics.h"
#include <stdlib.h> #ifndef _Included_com_fileText_fileRead
#define _Included_com_fileText_fileRead
#ifdef __cplusplus extern "C" {
#endif
//jobject arraylist; JNIEXPORT jint JNICALL Java_com_graphics_base_CplusGraphics_GetShpType
(JNIEnv *env, jobject obj) /*
* Class: CplusGraphics
* Method: SetShpType
* Signature: (I)V
*/
{
int i = 100;
jint type = i;
return type;
} #ifdef __cplusplus
}
#endif
#endif //其他类里面调用
System.out.println(CplusGraphics.GetShpType());
然后编译没问题,android模拟器里面运行程序,屏幕会卡住。
而
System.out.println("方法被调用之前--------------");
System.loadLibrary("ShapeRead");
System.out.println("方法被调用--------------");
中只有第一句输出了。就卡在第二句java语句上了。 求各位大大帮忙看看哪里错了。
解决方案 »
- 以下方式可以从某个点下载文件吗?
- android 视频播放在快速连续选择同一个文件播放时停止播放
- android下大家都用什么数据库框架?
- 播放rtsp视频一会儿后,不能播放了
- 我的真机启动不了了?????
- 请问这段代码为什么报错!ProgressDialog
- 关于短信备份sms格式恢复到手机的问题
- android ListView展示不出来数据,也没有提示错误。跪求大神帮忙
- android 定时更新数据
- Android中Fatal signal 11 (SIGSEGV) at 0x6df6d7bf (code=2), thread 31535 问题
- 请推荐一个PC端(Windows)用的Android文件浏览器
- android菜鸟求解释
是ndk的问题?不知道各位大大使用jni的时候是如何调试c/c++代码的?能否java代码转到c++代码?