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语句上了。 求各位大大帮忙看看哪里错了。
解决方案 »
- java web与android开发比较
- 关于apktool反编译与编译问题。
- android背景图片显示的问题
- 怎么用代码设置图片平铺?
- cygwin编译android windows SDK 出错(缺少toolchain)
- 请问这种类型的选项卡如何实现?
- 编译Android内核必须安装那些工具软件吗?什么build-essential等等,在不能上网的情况下怎么装这些工具软件?
- (难 !!!)修改system bar 的宽 度(难 !!!)
- 这个版本的ADT,zuo si 的节奏吗?!
- Android下listview每个Item中包含有按钮,为什么在点击某一行按钮的时候,同时有多行button触发了响应事件?
- 请推荐一个PC端(Windows)用的Android文件浏览器
- android菜鸟求解释
是ndk的问题?不知道各位大大使用jni的时候是如何调试c/c++代码的?能否java代码转到c++代码?