24

It seems like Read/Write external storage and Read phone state permissions are automatically added to the manifest on building the android apk. Are these necessary for all React Native android apps? Is there any way to remove these permissions?

Looking at the build/output/logs/manifest-merger-debug-report.txt I see:

android:uses-permission#android.permission.READ_EXTERNAL_STORAGE
IMPLIED from `/***/android/app/src/main/AndroidManifest.xml:1:1-22:12 reason: org.webkit.android_jsc` requested WRITE_EXTERNAL_STORAGE

It feels weird that I'll see these permissions being requested if I install the app from the Play store if I'm not using them.

Mike Wazowski
  • 241
  • 2
  • 4
  • I have the same issue. Here is my AndroidManifest.xml https://gist.github.com/1985media/385f726cf4f035ec3ed1 – Fisch Jan 15 '16 at 21:09
  • This seems related to http://stackoverflow.com/questions/1747178/android-permissions-phone-calls-read-phone-state-and-identity. However, simply adding this to my own manifest isn't sufficient: android/app/build/outputs/logs/manifest-merger-debug-report.txt suggests the permission is added because org.webkit.android_jsc has targetSdkVersion < 4. Not sure yet how to get rid of that. – Arnout Engelen Feb 03 '16 at 23:33
  • Did we ever come to a solution on this? I am still getting extra permissions being added to my react native app. – Steven Burnett Jun 23 '16 at 15:57

1 Answers1

21

I have an answer.

AndroidManifest.xml

Add this to manifest which should be line 1

xmlns:tools="http://schemas.android.com/tools"

It should look like this

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools"
      package="YOUR PACKAGE NAME">

Now you can remove the permissions with this

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />

So my permissions for a simple app are

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />

Don't remove SYSTEM.ALERT.WINDOW, you will have problems in development.

parker
  • 3,929
  • 1
  • 16
  • 19