cordova plugin(Cordova plugin add -- Failed to get absolute path to installed module)

本文目录
- Cordova plugin add -- Failed to get absolute path to installed module
- 如何解决failed to install cordova-plugin-console’错误
- cordova-plugin-statusbar怎么用
- cordova-plugin-file 是否含有某个文件
- 使用cordovaplugin怎么给activity返回数据
Cordova plugin add -- Failed to get absolute path to installed module
I got the same error message when adding a local plugin: Error: Failed to get absolute path to installed module.
Using the option --nofetch (cordova@7.0.1) fixed it:
cordova plugin add ../my-plugin --nofetch
如何解决failed to install cordova-plugin-console’错误
使用cordova platform add android命令时 报Failed to install ’cordova-plugin-whitelist’:Error: cmd: Command failed with exit code ENOENT 主要是为了build一个apk 使用cordova requirements android命令查看构建环境,已全部通过。
cordova-plugin-statusbar怎么用
Configure the device’s StatusBar with colors and styles.
cordova plugin add cordova-plugin-statusbar
module.controller(’MyCtrl’, function($cordovaStatusbar) {
$cordovaStatusbar.overlaysWebView(true);
// styles: Default : 0, LightContent: 1, BlackTranslucent: 2, BlackOpaque: 3
$cordovaStatusbar.style(1);
// supported names: black, darkGray, lightGray, white, gray, red, green,
// blue, cyan, yellow, magenta, orange, purple, brown
$cordovaStatusbar.styleColor(’black’);
$cordovaStatusbar.styleHex(’#000’);
$cordovaStatusbar.hide();
$cordovaStatusbar.show();
var isVisible = $cordovaStatusbar.isVisible();
});
同时,要在你的module里注入ngCordova,然后按照文档上的方法使用就行了
cordova-plugin-file 是否含有某个文件
不知道题主是不是用的cordova3.0以上的版本如果是的话。cordova_plugins.js是不需要手动引入的。一个常规的cordova项目的文件目录结构是这样的config.xmlhooksplatforms【buildfile】|----android/ios|----www会自动生成cordo
使用cordovaplugin怎么给activity返回数据
js中,调用phonegap.exec方法时,传入两个回调方法,success和faile。其方法实体大概如下
view plaincopyprint?
function setSuccess(entry) {
alert("set success:" + entry);
}
function setError(error) {
alert("set error:" + error);
}
而java方法中,其方法实体为
view plaincopyprint?
public boolean execute(String action, CordovaArgs args,
CallbackContext callbackContext) throws JSONException {
return false;
}
其返回值是boolean类型,返回true,则正确执行,界面无响应;
若返回值是false,则返回到faile回调方法,默认错误原因是 无效的action,如图:
在运行正确时,返回true,如果需要返回数值(字符串,对象等),可以用PluginResult,代码如下:
view plaincopyprint?
PluginResult mPlugin = new PluginResult(PluginResult.Status.OK,
wo);
mPlugin.setKeepCallback(true);
callbackContext.sendPluginResult(mPlugin);
使用这样的代码,返回值依然为true,则结果如图:可以看到是执行了success的回调方法。
出错了,如果是其他错误,可以这样写:
view plaincopyprint?
PluginResult mPlugin = new PluginResult(PluginResult.Status.ERROR,
wo);
mPlugin.setKeepCallback(true);
callbackContext.sendPluginResult(mPlugin);
返回值是false,则图为:可以看出,执行了faile的回调方法。
点击确定后,还会有
看来无论是给success回调,还是faile回调,都需要return true才行。

更多文章:
hover标签属性(a:hover{ color:#00F;}是什么意思,怎么使用)
2026年5月20日 07:45
js select(js 触发select onchange事件代码)
2026年5月19日 04:00
大于等于符号是什么?怎样在键盘上打出大于等于号,小于等于号急用!
2025年10月5日 00:45
用javascript加油优惠价格(现在用什么app加油最便宜)
2025年9月3日 01:45
js split 多个分隔符(js 如何用split()方法按根据“\”(反斜杠)分割字符串)
2026年8月20日 23:30
malloc返回的是什么(用malloc和数组指针申请二维数组返回什么)
2025年8月4日 09:15
mapping file(为什么File mapping比普通文件读写效率高)
2026年4月8日 06:30
translateit翻译成中文(他们正在会议中Translate it into Mandarin,)
2025年12月16日 18:45
stroke width(javascript如何实现把界面上的点,动态的依次连接成一个封闭的图形)
2025年11月9日 19:15
朱子学研究cssci来源集刊(中文社会科学引文索引的学科分类)
2026年5月4日 04:00
plsql删除表中某一条数据(plsqldeveloper删除表需要提交吗)
2026年6月10日 03:30











