Android的JNI错误 [英] android JNI ERROR
问题描述
我一个深化发展科尔多瓦/ PhoneGap的Android插件列出设备周围的WiFi。
I'm developping a cordova / phonegap android plugin to list wifi around the device.
进入我的插件类,我想用WifiManager做的工作。
我在这里的execute方法:
Into my plugin class, i want to use the WifiManager to do the work. Here my execute method :
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
Log.d ("WifiLister", "action : " + action);
if ("WifiList".equals(action)) {
wifiList(callbackContext);
return true;
}
return false; // Returning false results in a "MethodNotFound" error.
}
下面我wifiList方式:
Here my wifiList method :
private void wifiList(CallbackContext callbackContext) throws JSONException{
WifiManager wifiManager = (WifiManager) cordova.getContext().getSystemService(Context.WIFI_SERVICE);
if (!wifiManager.isWifiEnabled()) {
callbackContext.error("Wifi disabled, please turn on Wifi and try again");
}
else{
// do something
}
在isWifiEnabled方法调用,我得到了以下错误:
on the isWifiEnabled method call, i got the following error :
JNI ERROR (app bug): attempt to use stale local reference 0x1
VM aborting
fatal signal 11 (SISEGC) at 0Xdeadd00d (code=1)
我发现读与人同样的错误谁愿意让本机(C / C ++)code到Android应用程序,他们必须使用newGlobalRef方法。但它不是我的情况,我在纯java code。
I read found the same error with people who wants to make native (C/C++) code into android app, and they have to use the newGlobalRef method to . But it' not my case, i'm in pure java code.
任何一个可以帮助吗?
Any one can help?
谢谢!
推荐答案
有一个看的https://groups.google.com/forum/?fromgroups=#!msg/phonegap/U5U5X07bEUI/TG4VppzazfQJ - 这可能是一个权限问题。
Have a look at https://groups.google.com/forum/?fromgroups=#!msg/phonegap/U5U5X07bEUI/TG4VppzazfQJ - it might be a permissions issue.
这篇关于Android的JNI错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!