科尔多瓦的条形码扫描仪插件导致config.xml错误

时间:2018-10-30 12:54:14

标签: cordova cordova-plugins phonegap-plugins phonegap-build phonegap

我正在尝试使用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(debug)时,出现格式错误的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” 在Android的“ 1.3.3”上安装“ cordova-plugin-whitelist”

此插件仅适用于高于4.0的cordova-android版本。如果您使用的是以前的平台版本,则不需要 该插件,因为白名单将被内置。 通过npm获取插件“ cordova-plugin-device@1.1.3” 在Android的“ 1.1.3”安装“ cordova-plugin-device” 通过npm获取插件“ cordova-plugin-geolocation@2.4.0” 在Android的“ 2.4.0”安装“ cordova-plugin-geolocation” 通过npm获取插件“ cordova-plugin-compat@^1.0.0” 在Android的“ 1.2.0”安装“ cordova-plugin-compat” 插件“ cordova-plugin-compat”已安装在android上。使它成为顶级。 通过npm获取插件“ cordova-plugin-splashscreen@4.0.1” 在Android的“ 4.0.1”安装“ cordova-plugin-splashscreen” 警告:将compileSdkVersion从android-25(默认)覆盖到android-26

警告:不支持此操作,请考虑更新您的phonegap版本

项目属性

此文件由Android Tools自动生成。 请勿修改此文件-您的更改将被清除!

必须在版本控制系统中检查此文件。

要定制Ant构建系统使用的属性,请编辑 “ ant.properties”,并覆盖值以使脚本适应您的 项目结构。

要使ProGuard能够缩小和混淆代码,请取消注释(可用属性:sdk.dir,user.home): proguard.config = $ {sdk.dir} /tools/proguard/proguard-android.txt:proguard-project.txt 项目目标。 target = android-26

android.library.reference.1 = CordovaLib

COMPILE OUTPUT

子项目路径: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 UP-TO-DATE :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截止日期 :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截止日期 :compileDebugSources :mergeDebugShaders :compileDebugShaders :generateDebugAssets :mergeDebugAssets :transformClassesWithDexForDebug :mergeDebugJniLibFolders :transformNative_libsWithMergeJniLibsForDebug :processDebugJavaRes截止日期 :transformResourcesWithMergeJavaResForDebug :validateSigningDebug :packageDebug :assembleDebug :cdvBuildDebug

成功建立 总时间:2.007秒 命令以错误代码0结束:/ project / gradlew cdvBuildDebug,-b,/ project / build.gradle,-Dorg.gradle.daemon = true,-Dorg.gradle.jvmargs = -Xmx2048m,-Pandroid.useDeprecatedNdk = true 构建了以下apk: /project/build/outputs/apk/project-debug.apk

1 个答案:

答案 0 :(得分:0)

您必须将行添加到<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>