SDK40 - blank project - Android build full of permission requests in spite of app.json

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): Android
    (Developing under Windows 10 x64.)

My main project - originally built under Expo 38 but upgraded to Expo 40, ejected to RN, keeps requesting permissions about location, while I don’t use location features at all. I have been looking for solutions for 3 days now, to no avail. Tried everything in here: Removing location permission but none of this helped.

So, as a last resort, I decided to create a new Expo project with Expo 40 and latest React native. I ran a few simple steps that I followed from forum threads, but they don’t seem to do the trick: the new blank application still requests every possible permission. It’s as if I am missing something, or misunderstanding something? Here is what I did, step by step.

Step 1:
$ expo init myTest1
(bare workflow, blank app, javascript)

Step 2: open Visual Studio code and edit app.json, which now looks like this:

Step 3:
Delete folder /node_modules/expo-location

Step 4:
$ yarn android

Result: the application builds and runs well in the Android emulator. But the AndroidManifest.xml file in /android/app/src/main/AndroidManifest.xml still includes every single possible permission. Why?

I am quite new to mobile development and struggling with Expo, React Native, Android, iOS development, trying to connect the pieces but sometimes I feel like I’m missing things. I resort to reading and following the documentation step by step but sometimes it’s as if it just doesn’t work as expected.

see Permissions - Expo Documentation

When using the bare workflow, you have to blacklist permissions in your AndroidManifest.xml manually.

1 Like

Thank you brents, this is very helpful. To clarify, can you confirm that AndroidManifest.xml doesn’t get rebuilt, erased, or anything? I always assumed we couldn’t make changes to that file manually because they would somehow get erased or changed by … something (gradle? expo? react native? npm? yarn? no idea)

Hey @edukadev, those edits to your Manifest.xml will remain when building, debugging, etc.

1 Like

If this helps anyone, our application is simple and only requires Internet access (webview, fetch), as well as a QR code scanner that uses the camera and vibrates when a scan is successful.

This is our manifest with updated permissions. It took me 4 attempts to request the least number of permissions.

  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.CAMERA"/>
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission tools:node="remove" android:name="android.permission.FOREGROUND_SERVICE" />
  <uses-permission tools:node="remove" android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <uses-permission tools:node="remove" android:name="android.permission.WAKE_LOCK" />
  <uses-permission tools:node="remove" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission tools:node="remove" android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
  <uses-permission tools:node="remove" android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission tools:node="remove" android:name="android.permission.ACCESS_MEDIA_LOCATION" />
  <uses-permission tools:node="remove" android:name="android.permission.ACTIVITY_RECOGNITION" />
  <uses-permission tools:node="remove" android:name="" />
  <uses-permission tools:node="remove" android:name="" />
  <uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission tools:node="remove" android:name="" />

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.