Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Gradle / maxSdkVersion / READ_EXTERNAL_STORAGE

Discussion in 'Android' started by stanislav-osipov, Oct 17, 2018.

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello, I try to describe issues as short as possible.

    Unity 2018.2.11f1
    Project Settings Build System set to Gradle

    In my AndroidManifest.xml I have the following lines:
    Code (CSharp):
    1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    2. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    When I analyze built apk permissions I get
    Code (CSharp):
    1. uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE' maxSdkVersion='18'
    2. uses-permission: name='android.permission.READ_EXTERNAL_STORAGE' maxSdkVersion='18'
    Made few attempts to fix this by adding modifications to my AnroidMnifest permissions like:
    Code (CSharp):
    1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion" />
    or
    Code (CSharp):
    1. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>
    If I set Project Settings Build System set to Internal - works, no problem no maxSdkVersion added to permissions.

    Questions:
    1. Why Unity does this?
    2. How to prevent it from doing it?

    If you interested in more detailed "full story" it's here.
    Would appreciate any help! Thx.
     
    dimib likes this.
  2. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Anybody? It seems like a very important issue to me.
     
  3. The_Arrival

    The_Arrival

    Joined:
    Dec 3, 2014
    Posts:
    82
    +1 looking for an answer to this issue.
     
  4. dimib

    dimib

    Joined:
    Apr 16, 2017
    Posts:
    50
    I have this issue also in Unity 2019.1.3 , so it seems to be a general issue. No other AndroidManifest did add this attribute maxSdkVersion="18" and this caused a lot of trouble, because the device media library could not be accessed without any error or crash that could help us find the error quickly.

    I found it when I looked into the merged AndroidManifest.xml unter Project > Temp > StagingArea.

    And in the player settings we have set minimum api level 24 (Android 7.0) and maximum api level "highest possible", so in no case these strange maxSdkVersion="18" should be added by Unity build process.
     
  5. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    469
    +1 met the same issue
     
unityunity