我已经为 cordova android 创建了一个自定义插件,我想使用资源文件。因此我在插件中添加了以下标签
<resource-file src="src/android/res/values/strings.xml" target="res/values/strings.xml" />
但是,这会导致在为 android 构建时出现以下错误:
TypeError: 无法在 android_parser.update_from_config (C:\Users\Matthias\AppData\Roaming\npm\ node_modules\cordova\node_modules\cordova-lib\src\cordova\metadata\android_parse r.js:209 处设置 null 属性“文本” :51) 运行一个或多个平台时出错:TypeError: 无法将属性“文本”设置为 null
当我从plugin.xml中删除资源文件标签时,构建成功。尽管如此,我还是需要那些绳子。
有谁知道解决此问题的任何解决方案或替代方案?我在这里发现了类似的问题,不幸的是没有记录任何解决方案:
谢谢。
因此,我在远程设备上运行了 cordova 应用程序,并且我正在尝试测试扫描仪,因此必须在 Android 设备本身上进行测试。
但我不知道应该如何检查它抛出的错误,因为扫描仪在我的移动设备上无法工作。
任何帮助将不胜感激
谢谢
我正在编写一个自定义插件,它在后面的代码中执行一些繁重的工作。我有时想发送进度更新,以便可以在 Ionic 中显示它。我在 CallbackContext 中找不到合适的方法。只能发送一次成功回调。如何实现发送进度回调?
private void doHeavyStuff(final CallbackContext callbackContext){
something.execute(new ResponseHandler() {
@Override
public void onProgress(String message) {
callbackContext.success(message); //what else ?
}
@Override
public void onFailure(String message) {
callbackContext.error(message);
}
@Override
public void onSuccess(String message) {
callbackContext.success(message);
}
});
}
Run Code Online (Sandbox Code Playgroud) <?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-telerik-imagepicker"
version="2.2.4">
<name>ImagePicker</name>
<description>
This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app
</description>
<license>MIT</license>
<engines>
<engine name="cordova" version=">=3.5.0" />
</engines>
<js-module src="www/imagepicker.js" name="ImagePicker">
<clobbers target="plugins.imagePicker" />
</js-module>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="ImagePicker">
<param name="ios-package" value="SOSPicker"/>
</feature>
</config-file>
<preference name="PHOTO_LIBRARY_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
</config-file>
<header-file src="src/ios/SOSPicker.h" />
<source-file src="src/ios/SOSPicker.m" />
<header-file src="src/ios/GMImagePicker/UIImage+fixOrientation.h" />
<source-file src="src/ios/GMImagePicker/UIImage+fixOrientation.m" />
<header-file …Run Code Online (Sandbox Code Playgroud)我正在尝试为 ionic 5 应用程序构建一个 ios 版本,我在构建应用程序时在我的应用程序中收到此错误。我在互联网上寻找解决方案,但似乎没有任何效果
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:141:27: error: property
'defaultWebpagePreferences' not found on object of type 'WKWebViewConfiguration *'
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:141:76: error: use of undeclared
identifier 'WKContentModeMobile'
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:143:27: error: property
'defaultWebpagePreferences' not found on object of type 'WKWebViewConfiguration *'
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;
^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:143:76: error: use of undeclared
identifier 'WKContentModeDesktop'
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;
Run Code Online (Sandbox Code Playgroud) cordova ionic-framework cordova-plugins wkwebviewconfiguration ionic5
阅读本文PouchDB与Couchbase Lite - 性能评估后,我很高兴尝试运行代码https://github.com/zeMirco/pouchdb-vs-couchbase
该应用程序最初没有运行.我删除了平台并重建:
cordova platform add ios
cordova build ios
Run Code Online (Sandbox Code Playgroud)
然后我使用iPad视网膜64位模拟器运行应用程序.我注意到控制台输出了以下内容.
2014-05-30 14:38:08.518 HelloCordova[50407:60b] Multi-tasking -> Device: YES, App: YES
2014-05-30 14:38:08.526 HelloCordova[50407:60b] Unlimited access to network resources
2014-05-30 14:38:08.532 HelloCordova[50407:60b]
Started backup to iCloud! Please be careful.
Your application might rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines"
You could find it at the following address https://developer.apple.com/icloud/documentation/data-storage/ .
2014-05-30 14:38:08.594 HelloCordova[50407:60b] CDVPlugin class CBLite …Run Code Online (Sandbox Code Playgroud) 我是PhoneGap的新手,正在试图弄清楚如何使用捕获插件.我正在使用Cordova 3.5.0.我已成功运行以下命令:
cordova plugin add org.apache.cordova.media-capture
Run Code Online (Sandbox Code Playgroud)
我已经阅读了HTML页面中包含cordova.js或phonegap.js的示例.但是,Cordova创建的项目层次结构中不存在任何文件,因此我不知道如何包含它.我还读过这个文件是由Cordova在构建时自动注入的.因此,只要包含任何JavaScript文件,我只包含我自己的JavaScript文件.在JavaScript文件中,我有代码执行此操作以进行测试:
alert(navigator.device);
navigator.device.capture.captureImage(function(files) {
alert(files);
}, function(error) {
alert(error);
});
Run Code Online (Sandbox Code Playgroud)
第一个警报显示navigator.device未定义.我在android模拟器上运行这个应用程序.要运行该应用程序,我正在做:
cordova emulate android
Run Code Online (Sandbox Code Playgroud)
我认为我需要包含或设置一些东西才能使其正常工作.任何帮助是极大的赞赏.
我使用4.3.0版本和iOS项目项目创建了Cordova应用程序.
每当我在桌面浏览器中打开index.html(www文件夹)文件时,它就会陷入无限循环,请求gap :: // ready.
为什么会这样?我该如何解决?
非常感谢.
编辑和更新:
iOS应用程序无法运行,因为缺少一个插件:https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md
我添加它,然后再次构建项目,它工作.
MacBook-Pro:myApps naveenkumar$ ionic run ios
Adding in default Ionic hooks
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/010_add_platform_class.js /Users/naveenkumar/Documents/ionic_work/myApps
add to body class: platform-ios
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/naveenkumar/Documents/ionic_work/myApps
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
.
ERROR running one or more of the platforms: Error: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
MacBook-Pro:myApps naveenkumar$
Run Code Online (Sandbox Code Playgroud)
您好,我正在尝试从终端运行我的项目.我收到了上述错误.但是,当我去给定的iOS目录从Xcode运行我的项目时它工作正常.这意味着,当我从Xcode运行时,我能够运行模拟器/模拟器并检查我的输出.但是当我从终端运行时,我无法运行我的应用程序.你能告诉我如何从终端运行我的应用程序吗?
谢谢
我正在使用Ionic v2和Phonegap条码扫描器插件.
当执行下面的scanBarcode()函数时,我收到错误:
Uncaught TypeError: Cannot set property 'test' of null
Run Code Online (Sandbox Code Playgroud)
在
this.test = result.text;
Run Code Online (Sandbox Code Playgroud)
码:
import {Page} from 'ionic-angular';
@Page({
templateUrl: 'build/pages/scanBarcode/scanBarcode.html'
})
export class ScanBarcode {
constructor() {
this.test = "";
}
scanBarcode(){
cordova.plugins.barcodeScanner.scan(
function (result) {
console.log(result.text);
this.test = result.text;
console.log("SB result" + test);
},
function (error) {
alert("Scanning failed: " + error);
}
)
}
}
Run Code Online (Sandbox Code Playgroud)
第一个console.log没有错误,并显示正确的信息:
console.log(result.text);
Run Code Online (Sandbox Code Playgroud) cordova-plugins ×10
cordova ×7
android ×3
ios ×2
cordova-3 ×1
couchbase ×1
imagepicker ×1
ionic ×1
ionic2 ×1
ionic5 ×1
javascript ×1
pouchdb ×1