解决方案 »
- Gallery和ScrollView共用下出现左右滚动错乱,求大神解答!!
- Google Map:MapView的经纬度图标切换
- 类中没有继承MapActivity的选项。
- 小弟不才,求一个用其他软件来打开word和ppt文件的方法
- 怎样显示assets目录下的pdf文件
- Android平板电脑能否安装自己写的驱动?
- 热烈祝贺 Android 新开版块
- <set android:interpolator="@android:anim/decelerate_interpolator">
- 自定义了一个button,用keydown和keyup来控制图片的移动,报错了,麻烦帮看下吧,谢谢
- 自定义View继承TabHost时执行显示空指针异常
- 急!如何在java代码中获取string.xml中的字符串!
- 照片分享到社交平台是怎么实现的?
com_android_server_ CanService.cpp 定义的JNI方法不匹配导致的。同时,请确保
frameworks/base/services/java/com/android/server路径下存在 CanService.java 文件
frameworks/base/services/jni 路径下存在 com_android_server_ CanService.cpp 文件
注意你这两个文件的名称一定要匹配,不匹配的话就会出问题。
1,,....I register like this way in com_android_server_CanService.cppstatic const JNINativeMethod methods[] =
{
{"read_data", "()Ljava/lang/String;String jstring", (void *)read_flexcan},
{"flexcan_open", "()Z", (void *)flexcan_open}
};
2...in my CanService.java I wrote these code:
private static native boolean flexcan_open();
private static native String read_data();
of course both of them are in public class CanService extends ICanService.stub
3....the follow ocde are in my ICanService.aidl at android/ospackage android.os;interface ICanService{ boolean flexcan_open();
String read_data();}is something wrong???? Maybe I should delete the static at register java methods struct ...????
thanks a lot..(to be honest there are many ugly spelling and wrong use of English rule.I hope you understand me...)
static const JNINativeMethod method_table[] = {
{"init_native", "()Z", (void*)ttt_init},
{"setVal_native", "(I)V", (void*)ttt_setVal},
{"getVal_native", "()I", (void*)ttt_getVal},
};alright ,it's none of static's business..... I was wrong...
at first I declared the function proto at ICanService.aidl whit the same name in JNINativeMethod struct ...you know they are native and static....and I did this:
change the content in ICanService.aidl..Make sure the function proto in ICanService.aidl are implemented in CanService.java not the function proto which is declared in JNINativeMethod struct..