Search Issue Tracker

By Design

Votes

1

Found in

5.5.4p1

Issue ID

924794

Regression

No

[Android] READ_PHONE_STATE permission is added in the AndroidManifest.xml file using latest (26.0.2) SDK

Mobile

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 2No workaround

Steps to reproduce:

1) Update SDK to the latest version (26.0.2)
2) Download attached project 'Repo.zip' and open in Unity
3) Build .apk file
4) Open 'AndroidManifest.xml' file (Temp/StagingArea/AndroidManifest.xml)

Expected result:READ_PHONE_STATE permission should not be added in the AndroidManifest.xml (check attachment 'AndroidManifest_created_with_26.0.2.xml')
Actual result: READ_PHONE_STATE permission is added in the AndroidManifest.xml (check attachment 'AndroidManifest_created_with.25.2.3.xml')

Reproduced with:
5.5.4p1, 5.6.2p1, 2017.1.0f1, 2017.2.0b1

Note: READ_PHONE_STATE permission wasn't added using 25.2.5 sdk

RESOLUTION: By design. The project includes a plugin (com.nerd.TapdaqUnityPlugin) which does not specify targetSdkVersion in its manifest. Thus android manifest merger correctly assumes that the SDK version is lower than 4 and implicitly grants the READ_PHONE_STATE permission. See https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE. The difference between 25.2.5 and 26.0.2 SDKs is that in the latter we use different manifest merger implementation which is more strict.

Comments (12)

  1. Ef466ada72b1c5f639477657614208a5?d=mm

    ramioooz

    May 09, 2018 19:07

    --- SOLVED ---
    make sure to have the following line added to all AndroidManifest.xml files in your project

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25" />

    Notes :
    * I repeat, the line most be included to all AndroidManifest.xml files in your project. if you left any one behind this solution won't work.
    * the line should replace any occurence of <uses-sdk /> line tags.
    * I am using android SDK 25

    Thank you, good luck every one :)

  2. 4777d341768b28f7192cb7a09dd8d5d8?d=mm

    frjtrifork

    May 07, 2018 07:47

    I realize this issue is not a Unity issue as such as it is dependent on the Android build tools version installed and its embedded manifest merger and the combination of AndroidManifest files in the project and its dependencies.

    However, as many Unity android projects using plugins face this issue across many different Unity versions, it would be quite the time saver if a note about how this particular permission can be removed to the Unity FAQ.

    The best fix is to set the targetSdkVersion properly. But since the problem usually occurs due to the use of a third party plugin has been added to the project - it is not always possible to fix the plugins manifest. The FAQ could mention both the proper fix, and the fallback resolution to avoid this permission suggested by Russel on Nov 16 2017 in this issue comments - the one about using the tools namespace in your own manifest file and explicitly using tools:node="remove" to exclude that permission from the final manifest.

  3. 1b4bbfc373fd9ae1b1b438d9bad91470?d=mm

    Kastar-Troy

    Apr 11, 2018 01:14

    Posted this elsewhere, but thought I'd put it here too:

    So this is a really crappy change in the manifest merger, cause it seems to be responding to files which have nothing to do with the manifest.

    I made a blank project and copied across my plugins folder to reproduce, and it did. I then went to remove anything which could be the cause, and it turns out it wasn't any of the actual plugins and nothing to do with AndroidManifest.xml, it was /plugins/Android/res/!!!!
    Which was simply a collection of xml files containing localised strings, and png files.

    what the actual F is this manifest merger doing?

    Anyway, easy way to find out what is putting Read State into your config, is trial and error with a copied version of your project, keep deleting stuff in plugins till read state disappears. Bit of Scientific method always does the trick.

  4. 4083a28a8bbf7e6cdf0e66f5e4c73e31?d=mm

    LemanColt

    Mar 27, 2018 06:31

    Finally figured it out. It turned out to be one of the manifest files hidden in the Oculus VR plugin that lacked targetSdkVersion.

    This solved it for me:
    Upgrade the Oculus Utilities for Unity plugin to version 1.24.0

  5. 4083a28a8bbf7e6cdf0e66f5e4c73e31?d=mm

    LemanColt

    Mar 26, 2018 17:45

    I still have this issue. And I went through all the manifest files making sure they did not lack targetSdkVersion. All manifest files has a targetSdkVersion but I still get this issue.

  6. 27d7254dfc9beb2eb4f24a9c9fcad20b?d=mm

    Victor-Garcia

    Feb 26, 2018 17:49

    any solution for this annoying problem??

  7. F3c77979cdae1a536a976b78239f6758?d=mm

    DavidSWu

    Feb 22, 2018 00:49

    The remove command worked for me, but only in Android Studio/Gradle

  8. 7637bbcd7c3c7d4bc64405af0392c3c9?d=mm

    Russel

    Nov 16, 2017 12:48

    You can also use:

    <manifest ......... xmlns:tools="http://schemas.android.com/tools">

    ........

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

    This removed the specified attributes from the merged manifest.

    More here: https://developer.android.com/studio/build/manifest-merge.html

  9. 3324dd777b99a08e05b6cfa61bad6356?d=mm

    waken

    Oct 25, 2017 14:42

    Please fix it !!!!

  10. Be04a49e2ccb7e63fd4be2d80907e354?d=mm

    jknight-nc

    Oct 17, 2017 22:20

    This is terrible!

    "Allow "UNITY APP" to make and manage phone calls" is not an OK popup to deal with at the start of a game launch!

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.