我正在使用Cordova和Worklight 6.3开发应用程序,使用camera.getPicture函数时遇到问题。
请查看下面的相机代码段。
var cameraOptions = {
quality: 50,
targetWidth: 720,
targetHeight: 600,
encodingType: Camera.EncodingType.JPEG,
destinationType: Camera.DestinationType.DATA_URL,
correctOrientation: true,
sourceType: Camera.PictureSourceType.CAMERA
};
Android错误日志:
08-04 12:43:26.727: E/PluginManager(1168): Uncaught exception from plugin
08-04 12:43:26.727: E/PluginManager(1168): 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
08-04 12:43:26.727: E/PluginManager(1168): at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:560)
08-04 12:43:26.727: E/PluginManager(1168): at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:534)
08-04 12:43:26.727: E/PluginManager(1168): at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:376)
08-04 12:43:26.727: E/PluginManager(1168): at cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:302)
08-04 12:43:26.727: E/PluginManager(1168): at cordova.camera.CameraLauncher.callTakePicture(CameraLauncher.java:276)
08-04 12:43:26.727: E/PluginManager(1168): at cordova.camera.CameraLauncher.execute(CameraLauncher.java:185)
08-04 12:43:26.727: E/PluginManager(1168): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:86)
08-04 12:43:26.727: E/PluginManager(1168): at org.apache.cordova.PluginManager.exec(PluginManager.java:153)
08-04 12:43:26.727: E/PluginManager(1168): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:61)
08-04 12:43:26.727: E/PluginManager(1168): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40)
08-04 12:43:26.727: E/PluginManager(1168): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
08-04 12:43:26.727: E/PluginManager(1168): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:39)
08-04 12:43:26.727: E/PluginManager(1168): at android.os.Handler.dispatchMessage(Handler.java:102)
08-04 12:43:26.727: E/PluginManager(1168): at android.os.Looper.loop(Looper.java:148)
08-04 12:43:26.727: E/PluginManager(1168): at android.os.HandlerThread.run(HandlerThread.java:61)
我关注ibm Fix但是同样的错误 https://www.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.dev.doc/dev/t_android_cam_api_24.html
的AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId.fileprovider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
答案 0 :(得分:-1)
在default.xml中添加以下行
<preference name="applicationId" value="com.APPlol.test" />
// ID in widget is the value
<widget id="com.APPlol.test"></widget> // in config .xml