Cordova Camera发布时出错,但未在调试中出错

问题描述 投票:1回答:1

我正在使用Cordova制作应用程序,需要使用cordova相机插件和cordova MFP插件。在调试模式下,我的相机工作正常。但是,一旦我构建了应用程序的发布版本,相机就不再有效了,每次都会出错。我正在运行Cordova 6.5.0版,安装的Android平台版本是6.3.0。我还想提一下,我基本上没有涉及更改给我的Java代码。我所做的一切都是纯粹的JS。

奇怪的是,当未安装MFP时,应用程序的相机在发布时完美运行。所以,每当我做“cordova插件添加cordova-plugin-mfp”时,相机会以某种方式在发布版本中被破坏。这是我得到的错误:

attempt to invoke virtual method android.content.res.XMLResourceParser android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.Packagemanager, java.lang.String) on a null object

这是我的插件列表:

cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-mfp 8.0.2018090311 "IBM MobileFirst Platform Foundation"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-okhttp 2.0.0 "OkHttp"
cordova-plugin-spinner 1.1.0 "Spinner Plugin"
cordova-plugin-whitelist 1.3.3 "Whitelist"

我的AndroidManifest文件已被播放,因为我一直在尝试按照我在网上找到的解决方案。这是我的AndroidManifest文件:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:name="com.ibm.MFPApplication" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
        </provider>
        <activity android:name="com.worklight.wlclient.ui.UIActivity" />
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
        </provider>
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
    <uses-permission android:name="android.permission.STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

这几乎是我所有的config.xml文件,我不能分享它的顶部,但我可以分享95%的:

    <plugin name="cordova-plugin-whitelist" spec="1" />
    <plugin name="cordova-plugin-dialogs" />
    <plugin name="cordova-plugin-camera" />
    <plugin name="cordova-plugin-spinner" />
    <access origin="*" />
    <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">
        <preference name="loadUrlTimeoutValue" value="700000" />
        <allow-intent href="market:*" />
        <icon src="res/icon/android/icon-96-xhdpi.png" />
        <icon density="ldpi" src="res/icon/android/icon-36-ldpi.png" />
        <icon density="mdpi" src="res/icon/android/icon-48-mdpi.png" />
        <icon density="hdpi" src="res/icon/android/icon-72-hdpi.png" />
        <icon density="xhdpi" src="res/icon/android/icon-96-xhdpi.png" />
        <icon density="xxhdpi" src="res/icon/android/icon-144-xxhdpi.png" />
        <icon density="xxxhdpi" src="res/icon/android/icon-192-xxxhdpi.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <mfp:android>
        <mfp:sdkChecksum>3198985637</mfp:sdkChecksum>
        <mfp:appChecksum>0</mfp:appChecksum>
        <mfp:security>
            <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
        </mfp:security>
    </mfp:android>
    <mfp:ios>
        <mfp:sdkChecksum>0</mfp:sdkChecksum>
        <mfp:appChecksum>0</mfp:appChecksum>
        <mfp:security>
            <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
        </mfp:security>
    </mfp:ios>
    <mfp:windows>
        <mfp:windows8>
            <mfp:sdkChecksum>0</mfp:sdkChecksum>
            <mfp:security>
                <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
            </mfp:security>
        </mfp:windows8>
        <mfp:windowsphone8>
            <mfp:sdkChecksum>0</mfp:sdkChecksum>
            <mfp:security>
                <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
            </mfp:security>
        </mfp:windowsphone8>
        <mfp:windows10>
            <mfp:sdkChecksum>0</mfp:sdkChecksum>
            <mfp:security>
                <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
            </mfp:security>
        </mfp:windows10>
        <mfp:appChecksum>0</mfp:appChecksum>
    </mfp:windows>
    <mfp:platformVersion>8.0.0.00-20180903-073102</mfp:platformVersion>
    <mfp:clientCustomInit enabled="false" />
    <mfp:server runtime="mfp" url="http://10.0.0.1:9080" />
    <mfp:directUpdateAuthenticityPublicKey />
    <mfp:languagePreferences>en</mfp:languagePreferences>

因此,我开始失去理智。请帮我。调试标志,mfp和相机必定存在某种错误,我不知道如何修复它。

android cordova debugging camera release
1个回答
0
投票

删除插件

科尔多瓦 - 插件-MFP

接下来,添加相机插件,然后再次添加mfp插件。

现在它应该正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.