Camera permission fails after changing targetsdk version 29->30

Hi,

When we change the target sdk version in mobile-config.js from 29 to 30 with Meteor 1.10.2, everything still compiles and works fine except when trying to get the user permission for the Camera, it does fail without asking the user. And in the logs, we see:

> 03-12 14:50:23.991  7199  7319 V Diagnostic: Get authorisation status for android.permission.CAMERA
> 03-12 14:50:24.016  7199  7319 V Diagnostic: Get authorisation status for android.permission.CAMERA
> 03-12 14:50:24.017  7199  7319 D Diagnostic: Requesting permission for android.permission.CAMERA
> 03-12 14:50:24.094  7353  7353 V GrantPermissionsActivity: Permission grant result requestId=121511007399148254 callingUid=10488 callingPackage=com.hoptimizeme.hoptimizepro permission=android.permission.CAMERA isImplicit=false result=1
> 03-12 14:50:24.125  7199  7199 V Diagnostic: Authorisation for CAMERA is DENIED_ALWAYS
> 03-12 14:50:25.069  7199  7319 D CameraLauncher: Error: You don't have a default camera.  Your device may not be CTS complaint.
> 03-12 14:50:25.069  7199  7319 W PluginManager: THREAD WARNING: exec() call to Camera.takePicture blocked the main thread for 31ms. Plugin should use CordovaInterface.getThreadPool().

Our hypothesis is that the AndroidManifests lacks “android.permission.CAMERA”. When we open the Manifest, it’s clearly not there.

We’ve tried a lot of things without success:
As it’s cordova.plugins.diagnostic that is supposed to ask the user for the permission, we’ve tried to upgrade it to the latest 6.0.3 but when we do, we get duplicate classes error :

D8: Program type already present: android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForRelease'.
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
   Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
   Program type already present: android.support.v4.media.MediaBrowserCompatApi21$SubscriptionCallback
   
   * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Anybody with an idea of what to do to be able to make the camera work with target SDK 30 ?

Regards :slight_smile:
Burni

Is anybody using the camera on Target SDK 30 ?

If so, which plugins versions are you using.

Best regards :slight_smile:

FYI: for those who might encounter the same problem. Ok from my current understanding, Cordova Android plugin has still not been adapted for SDK30. Android seems to have changed quite a lot in regards to permissions in Android 11 and Cordova has not caught up yet.

I found this thread on Cordova’s forums about the camera.

So I guess we’ll just have to wait for Cordova to do an update and then for Meteor’s update as well.

Regards,

burni

1 Like