LoginSignup
8

More than 5 years have passed since last update.

【Unity】Android SDKのバージョンを26にしたら権限が勝手に付く対処法

Posted at

かなりハマったので。。。

元ネタ
https://forum.unity3d.com/threads/read_phone_state-permission-added-when-using-sdk-tools-26-0-2.481478/

概要

Android SDKのバージョンを最新(26)にしたところ、UnityでAndroidビルドした際に、
以下の権限が勝手に付与されるようになった。

・READ_PHONE_STATE
・READ_EXTERNAL_STORAGE
・WRITE_EXTERNAL_STORAGE

困る。

対処法

targetSdkVersionを26未満にする。

まず Player Settingsで、Target API Levelを変更する。

スクリーンショット 2017-07-18 19.05.24.png

もし、使用しているライブラリでAndroidManifest.xmlがある場合、
そのマニフェストファイルでもtargetSdkVersionの指定が必要。

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xxx.xxx.xxx">

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

    <application>

    </application>

</manifest>

これで権限が付与されなくなりました。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8