I’ve updated Android SDK tools to 26.0.2, and now game builds ask for READ_PHONE_STATE permission (and READ_EXTERNAL_STORAGE also). Switching back to 25.2.3 solves the problem. But, I would like to use latest SDK tools.
Plugins with manifests where targetSdkVersion is missing will cause this undesired behavior. The correct fix is to add this entry to the manifest - @pep_dj is correct.
@Yury-Habets I have been unable to resolve the unwanted addition of READ_PHONE_STATE in Cloud Builds. I cannot reproduce the introduction of that permission locally. I have ensured that I have buildToolsVersion of 26.0.1 in my locally exported build.gradle file. So, my first concern is that Cloud Build is doing something differently than I am locally. I’m using 5.3.6p1 both locally and on Cloud Build.
I’ve also made sure that every AndroidManifest has specified a minSdkVersion in the uses-sdk block of at least 9. My understanding from the documentation (Manifest.permission | Android Developers) (though it is slightly ambiguous) is that if minSdkVersion is specified greater than 3, the READ_PHONE_STATE will not be implicitly added. I have introduced targetSdkVersion when it was missing in my loose AndroidManifest files, but many of the google AARs contain AndroidManifest files inside them that only specify a minSdkVersion.
Can you help me to determine why Cloud Build is introducing this permission?
If the google AARs are missing targetSdkVersion - that’s bad. Can you please tell me which ones?
In that case, it has probably nothing to do with the cloud build. Pinging @dannyd in case this is something known.
Hi @Yury-Habets , I’ve just seen that 5.6.4p1 has been released but there doesn’t seem to be an obvious entry in the changelog referencing this bug, do you know if it made it in?
@Aurigan please read carefully - the fix I’ve been talking of is about having Assets/Plugins/Android/res folder present. In this case, we generate an Android library, and it was missing targetSdkVersion in the manifest. I fixed that.
However, if you have any plugins (libraries) added with NO targetSdkVersion in the manifest - you automatically get the dangerous permission in question. The only fix for this issue is to fix your plugins’ manifests.
@Yury-Habets Hi, the issue for me came from including the IronSource Ad SDK. While I could fix this by adding a target SDK version myself after some wasted minutes or hours of my day I view this as something that Unity could do for me … especially given that there’s a minimum and target API already set in Player Settings …
@Aurigan no - this is what the plugin author must do - claim the minimum and target SDK levels he is expecting his plugin to work with. We can’t decide it for him.