Weird behavior with permissions

Hi guys,

I’m working a little app always to improve my react (and expo) skills :wink:

But I need to get permissions for “camera” and “reading files” and getting no errors, but camera is not working if I build my APK with those permissions, it’s not working (I tried almost all one by one…long test…:sweat_smile:)

      "permissions": [
        "CAMERA",
        "READ_INTERNAL_STORAGE",
        "com.google.android.c2dm.permission.RECEIVE",
        "com.android.launcher.permission.INSTALL_SHORTCUT",
        "com.htc.launcher.permission.UPDATE_SHORTCUT",
      ]

So I decided to remove the permissions field, as the doc mentioned it, and now it’s working but I know on google store it will be for suuuuure rejected if I let all permissions requested (even not good for rating :wink:

Any idea which permissions I have to set ? Do I’m wrong with my permissions field’s array ?

Thanks :wink:

No body encounter this issue ?

Without permissions, app is working, but with field permissions, it’s not. What can I see it’s when I set CAMERA in permissions fields, only camera permissions is requested, not the media access.

I tried with this config:

      "permissions": [
        "CAMERA",
        "MANAGE_DOCUMENTS"
        "READ_INTERNAL_STORAGE",
        "WRITE_INTERNAL_STORAGE"
        "com.google.android.c2dm.permission.RECEIVE",
        "com.android.launcher.permission.INSTALL_SHORTCUT",
        "com.htc.launcher.permission.UPDATE_SHORTCUT",
      ]	

Do I have to request manually the access to document (media/photo) or with this configuration it should work ?

From the doc Permissions Expo Module it’s written:

Expo.Permissions.CAMERA
The permission type for photo and video taking.

So is that a bug or do I do something wrong ?

And in local from expo, it’s working well, it’s only when I build the apk file

does your app crash as well ? I am facing similar kind of issue (most likely permissions)

can you be more specific here? are you getting a crash? if so, please send crash logs

Yes, so the first time the app crashed with the function _lazycallable() undefined function. And then when i said camera is not working, it’s actually, the permissions is requested for camera but not the one to access to media/photo. Then you click on button and nothing happened, the camera is not opened.

I can see the difference btw permissions because on my development environment, both permissions are requested, camera and media/files. I tried many builds with differents permissions and each time, it’s the same behavior, only one permissions requested for the camera, not for the files.

Yesterday I made a build without permissions field, and everything is working fine.

This is the log from my real device after accepted the camera permission and clicking on button to open the camera:

07-31 17:25:18.059  2125  2499 I BroadcastQueue: am_broadcast_finished: [background,1,Intent { act=com.google.android.gms.measurement.UPLOAD flg=0x10 }]
07-31 17:25:18.262  2125  3102 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPerm
issionsActivity (has extras)} from uid 10335 on display 0
07-31 17:25:18.269  2125  3102 D ActivityTrigger: ActivityTrigger activityPauseTrigger
07-31 17:25:18.276 15026 15026 D j       : WARNING: getPackageName called on ScopedContext
07-31 17:25:18.284 15026 15026 D j       : WARNING: getPackageName called on ScopedContext
07-31 17:25:18.286 15026 15191 D j       : WARNING: getPackageName called on ScopedContext
07-31 17:25:18.286  2125  3186 I MediaFocusControl:  AudioFocus  abandonAudioFocus() from uid/pid 10335/15026 clientId=android.media.AudioManager@94be5b1abi19_0_0.host.exp.exponent.modules.api.av.AVMo
dule@d32ea96
07-31 17:25:18.301 15026 15209 D j       : WARNING: getPackageName called on ScopedContext
07-31 17:25:18.333  2125  3156 D ActivityTrigger: ActivityTrigger activityPauseTrigger
07-31 17:25:18.334  2125 11424 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@933dd01 attribute=null, token = andr
oid.os.BinderProxy@77bde5b
07-31 17:25:18.364  2125  3102 I BroadcastQueue: am_broadcast_enqueue: [background,0,Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) },1]
07-31 17:25:18.364  2125  2155 I BroadcastQueue: am_broadcast_finished: [background,0,Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) }]
07-31 17:25:18.368 15026 15026 E ag      : java.lang.ClassNotFoundException: abi19_0_0.com.facebook.soloader.SoLoader
07-31 17:25:18.369 15026 15026 E ag      : Runtime exception in RNObject: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.reflect.Method[] java.lang.Class.getMethods()' on
a null object reference
07-31 17:25:18.386 15026 15276 I RegistrationIntentService: GCM Registration Token: epgQ9PSDw7E:APA91bH-KggQvLR0z211aUS8d8x57b3NOCxBgOO9HabKspPaexAYkP1roOrxPVZoAUtAc6blQgm1gmVsAZptqzG_9SllFleGBO-EeY2R
mptRGKgv5hEZL_xe6fYLVq9ezEPe7vCiYE21
07-31 17:25:18.391 15026 15026 I Timeline: Timeline: Activity_idle id: android.os.BinderProxy@969d91 time:63253388
07-31 17:25:21.142 15278 15278 W qcom-system-dae: type=1400 audit(0.0:34121): avc: denied { read write } for name="diag" dev="tmpfs" ino=1978 scontext=u:r:qcomsysd:s0 tcontext=u:object_r:diag_device:s
0 tclass=chr_file permissive=0 ppid=1 pcomm="init" pgid=1 pgcomm="init"

Any idea ?

Thanks for your help :wink:

Hey i have solved my problem by adding missing permissions, check adb logcat for missing permissions.

I was also getting the same error like you

java.lang.ClassNotFoundException: abi19_0_0.com.facebook.soloader.SoLoader

I actually did it the logcat and I can see some missing permissions but even if I add them, it’ still the same issue. It doesn’t request the access to media/files.

Because in my logcat, I can see error from expo:

MediaFocusControl: AudioFocus abandonAudioFocus() from uid/pid 10335/15026 clientId=android.media.AudioManager@94be5b1abi19_0_0.host.exp.exponent.modules.api.av.AVMo
dule@d32ea96

and indeed same error as you:

java.lang.ClassNotFoundException: abi19_0_0.com.facebook.soloader.SoLoader

Is that possible to see your permissions field ? Do you use facebook login ? (I don’t use any facebook mods/api)

Thanks :wink:

My permission fields are
[
“ACCESS_COARSE_LOCATION”,
“ACCESS_FINE_LOCATION”,
“android.permission.CHANGE_CONFIGURATION”,
“com.google.android.c2dm.permission.RECEIVE”,
“android.permission.READ_EXTERNAL_STORAGE”,
“android.permission.WRITE_EXTERNAL_STORAGE”
]

Although I feel I don’t need most of these permissions. Still I am sticking to expo, heck the maintenance cost of app is low :slight_smile:

1 Like

Oki thanks :wink:

I’m gonna try with to build a new APK, I’ll be in touch :wink:

(maybe change_configuration permissions make the fix…:roll_eyes:

Ok so I tried to build a new APK with this permission field:

      "permissions": [
        "android.permission.CAMERA",
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.READ_INTERNAL_STORAGE",
        "android.permission.WRITE_INTERNAL_STORAGE",
        "android.permission.MANAGED_DOCUMENTS",
        "android.permission.CHANGE_CONFIGURATION",
        "com.google.android.c2dm.permission.RECEIVE",
        "com.android.launcher.permission.INSTALL_SHORTCUT",
        "com.htc.launcher.permission.UPDATE_SHORTCUT"
      ]

And now it’s working fine, I have two permissions requested.

I don’t know, but I have some doubt where we have to add

android.permissions

before eeach permissions displayed in doc expo v19.0.0

I’m gonna try to upload it on google store as alpha to check which permissions is requested. I’ll be in touch :wink: