cordova - cordova 的条码扫描器插件导致 config.xml 错误
问题描述
我正在尝试使用 cordova.plugin.barcodescanner 来处理我的应用程序。该插件将这些行添加到我的 config.xml
<config-file mode="merge" parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
当我尝试构建 apk(调试)时,出现格式错误的 config.xml 错误。
然后我将它添加到我的小部件标签中:
xmlns:android="http://schemas.android.com/apk/res/android"
导致正确构建应用程序,但我的 http.get(ajax) 中断并停止工作。
这是我的完整 config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="24" defaultlocale="en-US" id="com.fynsis.fyncrmqrapp" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
<name><MY APP NAME></name>
<description><MY DESC></description>
<author email="TEST@gmail.com" href=""><MY NAME></author>
<content src="index.html" />
<access origin="*" />
<vs:features />
<preference name="SplashScreen" value="screen" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreenDelay" value="4000" />
<preference name="windows-target-version" value="8.1" />
<preference name="loadUrlTimeoutValue" value="700000" />
<plugin name="cordova-plugin-whitelist" version="1" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<platform name="android">
<icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
<icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
<icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
<icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
</platform>
<platform name="ios">
<icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
<icon height="60" src="res/icons/ios/icon-60.png" width="60" />
<icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
<icon height="76" src="res/icons/ios/icon-76.png" width="76" />
<icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
<icon height="40" src="res/icons/ios/icon-40.png" width="40" />
<icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
<icon height="57" src="res/icons/ios/icon-57.png" width="57" />
<icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" />
<icon height="72" src="res/icons/ios/icon-72.png" width="72" />
<icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
<icon height="29" src="res/icons/ios/icon-small.png" width="29" />
<icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
<icon height="50" src="res/icons/ios/icon-50.png" width="50" />
<icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
</platform>
<platform name="windows">
<icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" />
<icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" />
<icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" />
<icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" />
<icon height="44" src="res/icons/windows/Square44x44Logo.scale-100.png" width="44" />
<icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" />
<icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" />
<icon height="71" src="res/icons/windows/Square71x71Logo.scale-100.png" width="71" />
<icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" />
<icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" />
<icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" />
<icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" />
<icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" />
</platform>
<platform name="wp8">
<icon height="99" src="res/icons/wp8/ApplicationIcon.png" width="99" />
<icon height="159" src="res/icons/wp8/Background.png" width="159" />
</platform>
<platform name="android">
<splash density="land-hdpi" src="res/screens/android/screen-hdpi-landscape.png" />
<splash density="land-ldpi" src="res/screens/android/screen-ldpi-landscape.png" />
<splash density="land-mdpi" src="res/screens/android/screen-mdpi-landscape.png" />
<splash density="land-xhdpi" src="res/screens/android/screen-xhdpi-landscape.png" />
<splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png" />
<splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png" />
<splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png" />
<splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" />
</platform>
<platform name="ios">
<splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320" />
<splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" />
<splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768" />
<splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />
<splash height="1136" src="res/screens/ios/screen-iphone-568h-2x.png" width="640" />
<splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" />
<splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" />
<splash height="1242" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" />
</platform>
<platform name="windows">
<splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" />
<splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" />
<splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" />
</platform>
<platform name="wp8">
<splash height="1280" src="res/screens/wp8/SplashScreenImage.png" width="768" />
</platform>
<preference name="android-minSdkVersion" value="19" />
<preference name="android-maxSdkVersion" value="28" />
<preference name="android-targetSdkVersion" value="26" />
<preference name="Orientation" value="portrait" />
<plugin name="cordova-plugin-device" version="1.1.3" />
<plugin name="cordova-plugin-geolocation" version="2.4.0" />
<plugin name="cordova-plugin-compat" version="1.1.0" />
<plugin name="cordova-plugin-splashscreen" version="4.0.1" />
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>This app features timesheet entries, i.e, user can punch in/out recording their date, time and location. work hours are calculated based on it. The location information is sent their own CRM systems for their manager's reference for reviewing timesheets.</string>
</edit-config>
<config-file mode="merge" parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
<engine name="android" spec="~5.1.1" />
</widget>
这是我的日志:
构建日期:2018-10-31 09:43:49 +0000
插件输出
通过npm获取插件“cordova-plugin-whitelist@1”在“1.3.3”为android安装“cordova-plugin-whitelist”
该插件仅适用于cordova-android 4.0 以上的版本。如果您有以前的平台版本,则不需要此插件,因为将内置白名单。通过 npm 获取插件“cordova-plugin-device@1.1.3” 在“1.1.3”安装“cordova-plugin-device” " 对于 android Fetching 插件 "cordova-plugin-geolocation@2.4.0" 通过 npm 在 "2.4.0" 上安装 "cordova-plugin-geolocation" 对于 android Fetching 插件 "cordova-plugin-compat@^1.0.0" 通过 npm在“1.2.0”为android安装“cordova-plugin-compat”插件“cordova-plugin-compat”已经安装在android上。使其成为顶级。通过 npm 获取插件“cordova-plugin-splashscreen@4.0.1”安装“
警告:这是不受支持的,请考虑更新您的 phonegap 版本
项目性质
此文件由 Android 工具自动生成。请勿修改此文件——您的更改将被删除!
必须在版本控制系统中检查此文件。
要自定义 Ant 构建系统使用的属性,请编辑“ant.properties”,并覆盖值以使脚本适应您的项目结构。
要使 ProGuard 能够缩小和混淆您的代码,请取消注释(可用属性:sdk.dir、user.home):proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project。 txt 项目目标。目标=android-26
android.library.reference.1=CordovaLib
编译输出
子项目路径:CordovaLib 运行命令:/project/gradlew cdvBuildDebug -b /project/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true Task.leftShift(Closure)方法已被弃用,并计划在 Gradle 5.0 中删除。请改用 Task.doLast(Action)。在 build_dwomais0s9mkq91rc7xy5fcb5.run(/project/build.gradle:137) JavaCompile.setDependencyCacheDir() 方法已被弃用,并计划在 Gradle 4.0 中删除。增量java编译是一个孵化特性。TaskInputs.source(Object) 方法已被弃用,并计划在 Gradle 4.0 中删除。请改用 TaskInputs.file(Object).skipWhenEmpty()。ProjectDependency.getProjectConfiguration() 方法已被弃用,并计划在 Gradle 4.0 中删除。ModuleDependency.getConfiguration() 已被弃用,并计划在 Gradle 4.0 中删除。请改用 ModuleDependency.getTargetConfiguration()。:preBuild 最新 :preDebugBuild 最新 :checkDebugManifest :CordovaLib:preBuild 最新 :CordovaLib:preDebugBuild 最新 :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl :CordovaLib:compileDebugNdk最新:CordovaLib:compileLint:CordovaLib:copyDebugLint 最新:CordovaLib:mergeDebugShaders:CordovaLib:compileDebugShaders:CordovaLib:generateDebugAssets:CordovaLib:mergeDebugAssets:CordovaLib:mergeDebugProguardFiles:CordovaLib:packageDebugRenderscript 最新:CordovaLib: compileDebugRenderscript :CordovaLib:generateDebugResValues :CordovaLib:generateDebugResources :CordovaLib:packageDebugResources :CordovaLib: processDebugManifest :CordovaLib:generateDebugBuildConfig :CordovaLib:processDebugResources :CordovaLib:generateDebugSources :CordovaLib:incrementalDebugJavaCompilationSafeguard :CordovaLib:compileDebugJavaWithJavac :CordovaLib:compileDebugJavaWithJavac - 不是增量的(例如输出已更改,之前没有执行等)。注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。:CordovaLib:processDebugJavaRes UP-TO-DATE :CordovaLib:transformResourcesWithMergeJavaResForDebug :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug :CordovaLib:mergeDebugJniLibFolders :CordovaLib:transformNative_libsWithMergeJniLibsForDebug :CordovaLib:transformNative_libsWithSyncJniLibsForDebug :CordovaLib:bundleDebug :prepareProjectCordovaLibUnspecifiedDebugLibrary :prepareDebugDependencies : compileDebugAidl :compileDebugRenderscript :generateDebugBuildConfig :generateDebugResValues :generateDebugResources :mergeDebugResources :processDebugManifest :processDebugResources :generateDebugSources :incrementalDebugJavaCompilationSafeguard :compileDebugJavaWithJavac :compileDebugJavaWithJavac - 不是增量的(例如输出已更改,之前没有执行等)。注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。:compileDebugNdk UP-TO-DATE :compileDebugSources :mergeDebugShaders :compileDebugShaders :generateDebugAssets :mergeDebugAssets :transformClassesWithDexForDebug :mergeDebugJniLibFolders :transformNative_libsWithMergeJniLibsFor Debug :processDebugJavaRes :transformResourcesWithMergeJavaResForDebug:package:validate:SigningDebug
构建成功总时间:2.007 秒命令完成,错误代码为 0:/project/gradlew cdvBuildDebug,-b,/project/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,- Pandroid.useDeprecatedNdk=true 构建了以下 apk(s): /project/build/outputs/apk/project-debug.apk
解决方案
您必须将行添加到<platform name="android">
标签中
我认为你必须<platform name="ios">
对这些行做同样的():
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>This app features timesheet entries, i.e, user can punch in/out recording their date, time and location. work hours are calculated based on it. The location information is sent their own CRM systems for their manager's reference for reviewing timesheets.</string>
</edit-config>
推荐阅读
- java - Jboss eap 6.4 https 配置监听端口 8443 失败
- ios - 目录“/Users/vsts/agent/2.152.1/work/16/a”为空。不会添加任何内容来构建工件“drop”
- oracle - WebSphere App 和 Oracle 数据库之间的 SSL 加密问题
- java - 如何在 Jenkins 作业中运行 Java 服务器而不等待服务器关闭?
- centos - Ansible - 如何在 CentOS 中添加/修改 PATH 变量?
- python - “NoneType”类型的对象没有 len() 错误
- c++ - 将 lambda 作为参数的函数的 gmock expect_call 编译失败
- mysql - 强制 mysqldump 将 row_format 值添加到 CREATE TABLE 语句
- html - 盒子怎么修?
- docker - 如何在不覆盖现有的情况下将命令附加到 docker-compose.yml?