2017-03-22 48 views
-2

我們在我們的項目中使用了Cordova相機插件。在應用iFix-7.1.0.0-MFPF-IF201703011645之前它工作正常。navigator.camera.getPicture在MFP後無法在android中使用iFIX - 7.1.0.0-MFPF-IF201703011645

請檢查下面的代碼片段的相機。

$scope.cameraOptions = { 
         quality: 50, 
         destinationType: Camera.DestinationType.DATA_URL, 
         sourceType : Camera.PictureSourceType.CAMERA 
        }; 

navigator.camera.getPicture(success , failure , $scope.cameraOptions); 

Android的錯誤日誌:

03-21 20:36:41.990: E/PluginManager(29129): Uncaught exception from plugin 
03-21 20:36:41.990: E/PluginManager(29129): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference 
03-21 20:36:41.990: E/PluginManager(29129):  at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:560) 
03-21 20:36:41.990: E/PluginManager(29129):  at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:534) 
03-21 20:36:41.990: E/PluginManager(29129):  at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:376) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:278) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.camera.CameraLauncher.callTakePicture(CameraLauncher.java:258) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.camera.CameraLauncher.execute(CameraLauncher.java:167) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:86) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.PluginManager.exec(PluginManager.java:153) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:61) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) 
03-21 20:36:41.990: E/PluginManager(29129):  at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:41) 
03-21 20:36:41.990: E/PluginManager(29129):  at android.os.Handler.dispatchMessage(Handler.java:102) 
03-21 20:36:41.990: E/PluginManager(29129):  at android.os.Looper.loop(Looper.java:135) 
03-21 20:36:41.990: E/PluginManager(29129):  at android.os.HandlerThread.run(HandlerThread.java:61) 
03-21 20:36:41.997: I/chromium(29129): [INFO:CONSOLE(204)] "Failed because: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference", source: 
+0

注意,請求緊迫感這裏給你一些當之無愧downvotes - 不要做它! – halfer

回答

0

作爲臨時解決辦法,請的代碼下面的行添加到您的AndroidManifest.xml應用程序代碼中:

<provider 
     android:name="android.support.v4.content.FileProvider" 
     android:authorities="${applicationId}.provider" 
     android:exported="false" 
     android:grantUriPermissions="true" > 
     <meta-data 
      android:name="android.support.FILE_PROVIDER_PATHS" 
      android:resource="@xml/provider_paths"/> 
</provider> 
+0

相關博客可以在這裏找到 - https://mobilefirstplatform.ibmcloud.com/blog/2017/02/14/cordova-plugin-camera-fix-for-android-n/ – Keerthi

+0

非常感謝你Keerthi ..其工作..在AndroidManifest.xml和config.xml中做了更改 – prashant

0

這似乎是一個問題。請使用IBM MobileFirst打開PMR以接收修復程序。

相關問題