READ_PHONE_STATE is granted when building Android in Unity


Occurred when BuildTools of Android was built with 26.0.2 or later.

Cause

In the new BuildTools, behavior when merge changed when there were multiple AndroidManifest.xml.

If both minSdkVersion and targetSdkVersion are not specified, authority for maintaining backward compatibility such as READ_PHONE_STATE is given without permission.

*https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE

This behavior itself is correct, it seems that the designation of AndroidManifest has become stricter than before.

Coping

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+  <uses-sdk android:targetSdkVersion="26" android:minSdkVersion="19" />
  <application>
  </application>
</manifest>

AUTHOR

READ NEXT

Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?