如何强制cordova重新编译添加的插件? [英] How to force cordova to recompile added plugins?
问题描述
似乎cordova
会缓存已编译的插件,当我更改插件的源代码(Windows上的.java
文件)时,迫使Cordova重新编译插件的唯一方法是先删除然后再添加该插件,是一种痛苦.
有什么方法可以清理cordova缓存或强制其重新编译添加的插件?
It seems cordova
caches compiled plugins, when i change the source code of plugins (.java
files on windows), the only way to force cordova to recompile the plugin is to remove and then add that plugin again, which is a pain .
Is there any way to clean cordova cache or force it to recompile added plugins ?
推荐答案
不是afaik,我发现的唯一解决方法是每次准备应用程序时都使用before_prepare脚本删除并添加插件:
Not afaik, the only workaround I've found is to use a before_prepare script to remove and add the plugin every time you prepare the app:
/
|--hooks/
|--before_prepare/
|--000_RefreshPluginXXX.sh
000_RefreshPluginXXX.sh:
000_RefreshPluginXXX.sh:
!#/user/bin/env bash
cordova plugin rm yourPlugin
cordova plugin add yourPlugin
有关详细信息,请参见此处一个>.希望sh文件可以在Windows环境下工作,否则可以使用.bat
文件来实现.
See here for details. Hope that sh file works under windows environment, otherwise you can do it with a .bat
file.
请注意,每次准备应用程序时,它将为每个平台删除,下载并重新安装指定的插件(在构建/仿真/编译时进行准备)
Beaware that this is going to remove, download and reinstall the specified plugins for every platform every time that you prepare your app (prepare occurs when you build/emulate/compile)
这篇关于如何强制cordova重新编译添加的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!