Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity 5.6.2p2 adds android permission WRITE_EXTERNAL_STORAGE automatically, how to remove it?

Discussion in 'Android' started by neonxu, Jul 7, 2017.

  1. neonxu

    neonxu

    Joined:
    Nov 2, 2016
    Posts:
    12
    When I create a empty folder in: Plugins/Android/res
    Unity will auto add WRITE_EXTERNAL_STORAGE permission.
    But we do not need this permission. This will cause the google play user to fail to update.
    How can I remove it?
     
  2. neonxu

    neonxu

    Joined:
    Nov 2, 2016
    Posts:
    12
    All of the following permissions we would like to be able to remove:
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     
  3. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I'm trying to remove:
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
     
  4. nicoplv-auto

    nicoplv-auto

    Joined:
    May 28, 2013
    Posts:
    12
    I have the same problem, when my Unity project contains the folder Plugins/Android/res that add this permissions.
    Why Unity does add this permissions ? I really don't think it's obligatory, it's possible it's a Unity bug ?
     
  5. nicoplv-auto

    nicoplv-auto

    Joined:
    May 28, 2013
    Posts:
    12
    Ok, I found a tricky solution ... but it's working

    Don't add your android ressources inside your Unity project but on the default android project of Unity here: {UnityInstallPath}\Editor\Data\PlaybackEngines\AndroidPlayer\Apk\res

    If you do that, Unity will not add the permissions automatically.
     
  6. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I found that certain versions on unity and the android build tools do not put the permission in the manifest. Unity 5.6.2p4 with SDK tools 25.2.5 works.
     
  7. JPhilipp

    JPhilipp

    Joined:
    Oct 7, 2014
    Posts:
    56
  8. JPhilipp

    JPhilipp

    Joined:
    Oct 7, 2014
    Posts:
    56
    Oops. It doesn't work -- Unity simply adds the permission again at the end of one's custom file when building!
     
  9. JPhilipp

    JPhilipp

    Joined:
    Oct 7, 2014
    Posts:
    56
  10. JPhilipp

    JPhilipp

    Joined:
    Oct 7, 2014
    Posts:
    56
    ... argh, but that might cause conflicts when uploading to Google Play. Trying with maxSdkVersion 18 now...