Ionic:Cordova插件未更新 [英] Ionic: Cordova plugin not updating
问题描述
我想稍微更改一下Cordova的条形码扫描仪插件,所以将其分叉并
I want to change the Barcode scanner plugin for Cordova a bit, so forked it and changed something rather simple for testing purposes.
正如您在第87行看到的那样,我将result_uri
更改为result_text
.这样,当我扫描URL时,信息将显示我扫描了纯文本.
As you can see on line 87, I changed the result_uri
to result_text
. This way, when I would scan a URL, the information would say I scanned plain text.
然后,我使用cordova plugin add https://github.com/binoculars88/phonegap-plugin-barcodescanner
将此插件添加到了Ionic项目中.
Then, I added this plugin to my Ionic project, using cordova plugin add https://github.com/binoculars88/phonegap-plugin-barcodescanner
.
浏览到我的文本编辑器中的文件确实显示了我的编辑.但是...当我在设备上运行该应用程序时,它总是说找到URL".
Browsing to the files in my text editors does show my edits. But... when I run the application on my device, it keeps saying "URL Found".
好像我的更改不适用...有人知道该怎么做吗?谢谢一堆!
It's like my changes don't apply... Anyone knows what to do? Thanks a bunch!
更新:
我尝试更改strings.xml
文件中的文本本身,仅用于测试.
我注意到,这确实需要删除并重新添加平台和插件.之后,更改文本.
UPDATE:
I've tried changing the text itself in the strings.xml
file, just for testing.
I've noticed that this indeed needs a remove and re-add of the platform and plugin. After that, the text is changed.
因此strings.xml
中的更改确实适用,但原始问题仍然存在:.java
文件中的更改似乎不适用.
So changes in strings.xml
do apply, but the original problem remains: changes in a .java
file don't seem to apply.
此测试的最终目标是缩短扫描代码(并显示结果文本)后的持续时间.在CaptureActivity.java
中,我将DEFAULT_INTENT_RESULT_DURATION_MS = 1500L
更改为DEFAULT_INTENT_RESULT_DURATION_MS = 15L
,但是持续时间保持不变,即使在删除并重新添加android平台和插件之后.
The ultimate goal of this testing, is to make the duration time after a code is scanned (and the result text is shown) smaller. In CaptureActivity.java
, I've changed DEFAULT_INTENT_RESULT_DURATION_MS = 1500L
to DEFAULT_INTENT_RESULT_DURATION_MS = 15L
, but the duration time stays the same, even after removing and re-adding android platform and plugin.
推荐答案
我一直在进行cordova-plugin-camera-preview
的工作,并且连续运行以下命令似乎有效:
I have been doing work on the cordova-plugin-camera-preview
and running these commands in succession seems to work:
ionic cordova platform rm android
ionic cordova platform add android
ionic cordova run android
我已将这些命令设置为别名,以便可以快速重新编译插件中的.java文件.
I've set those commands as an alias so I can quickly recompile the .java files in the plugin.
虽然我仍然遇到问题,但是我已经在插件.java文件中添加了一些功能,但是当我在我的home.page.ts
文件中调用这些功能时,它说它们不存在.
I am still having issues though, I have added some functions to the plugin .java file but when I go to call those functions in my home.page.ts
file, it says they don't exist.
这篇关于Ionic:Cordova插件未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!