手动添加科尔多瓦(PhoneGap的)插件,以现有的Android项目 [英] Adding Cordova (Phonegap) Plugins manually to existing android projects
问题描述
我试图增加额外的PhoneGap的插件(即文件插件)到使用PhoneGap的现有的Android应用程序。
I'm trying to add additional Phonegap plugins (namely, the File plugin) to an existing android application that uses Phonegap.
我试着浏览我的项目目录(在我的工作区),然后运行命令
I've tried navigating to my project directory (in my workspace) and then run the command
cordova plugin add https://theurlwhichworks.org/
报告说,插件安装,当我去看看在我的工作空间我的电脑上,有一个文件夹名为插件,并在里面,一个名为
It says the plugin is installing, and when I go to look in my workspace on my computer, there is a folder titled plugins, and inside, a directory called
org.apache.cordova.file
这意味着插件(显然)下载的正确,但似乎并没有被添加到我的项目。
which means that the plugin (apparently) downloaded correctly, but doesn't seem to have been added to my project.
有没有什么办法来手动添加这个插件(或其他人)给我的直接Android项目?我建+运行我的应用程序从月食一个连接的设备,因为任何时候我尝试使用CLI关于科尔多瓦/ PhoneGap的我似乎总是做得不对,或结果是不是在所有我所期待的。
Is there any way to manually add this plugin (or others) to my android project directly? I build+run my application to an attached device from eclipse, because anytime I try to use the CLI with regard to cordova/phonegap I always seem to be doing something wrong, or the result is not at all what I expected.
希望这可以手动添加这些插件。我AP preciate任何建议
Hopefully it is possible to add these plugins manually. I appreciate any suggestions
推荐答案
它可以手动添加插件,那就是我们如何在科尔多瓦/ PhoneGap的CLI或PlugMan前的旧时代做到了。
It is possible to add plugins manually, and that is how we did it in the old days before the Cordova/Phonegap CLI or PlugMan
选项
一个。使用PlugMan直接
A. use PlugMan directly
npm install -g plugman
检查出plugman文档。一个科尔多瓦项目之外,plugman是一个干净的自动安装你最好的选择。
check out the plugman documentation. Outside of a Cordova project, plugman is your best bet for a clean automated install
乙。手动
-
.java文件添加到Android项目src /目录 记得他们的路径必须匹配其命名空间
add the .java files to the android project src/ directory remember their path has to match their namespace
地方倾倒插件js文件的资产/ WWW / *
dump the plugin js file somewhere in assets/www/*
添加新功能标签平台的config.xml
add a feature tag to platform config.xml
这已经很长一段时间,因为我手动添加一个插件,而科尔多瓦插件规范发生重大变动多次,自那时以来,已经一去不复返了。您可能需要手动包括插件的js实现(的index.html例如通过脚本标记)
It has been a long time since I added a plugin manually, and the cordova plugin spec has gone through major changes multiple times since then. You may need to manually include the plugin js implementation (eg via script tags in index.html)
我会强烈建议您使用PlugMan,或者至少尝试手动安装了。
I would highly recommend you use PlugMan, or at least try before the manual install.
这篇关于手动添加科尔多瓦(PhoneGap的)插件,以现有的Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!