Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

App Bundle requires Internet permissions

Discussion in 'Android' started by sstrong, Jan 29, 2020.

  1. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,192
    Apologies if this has been asked before, but why do Unity created app bundles require Internet permissions? When I upload an app bundle to the Google Play Console it has the following attribute:

    Required permissions 1 permission: android.permission.INTERNET
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Is it only when you build App Bundle? Is this permission not required when you build the APK? The required permissions should be the same whether you build the APK or an app bundle.
     
  3. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,192
    Oh, possibly, I didn't check. Is this required for all Play Store builds or do I have something set wrong in my configuration? The reason I ask is that my game doesn't specifically need internet access.
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    No, this is not required for all Play Store builds. Maybe you are using some plugins that use internet and so they would require this permission. If you have any ads plugins, analytics or other types of reporting packages, they will need internet access.
     
  5. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,192
    Hmm, no it is our own asset so we own 99% of the code base. We do have the new Input System package but can't see how that would require it. Do you know how this gets added to the manifest? Is this Google adding it or Unity?
     
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Google tools themselves should not add this. So either you have it already specified in the manifest or Unity adds it there. In player settings there is an option called "Internet Access". Check if it's not set to require. Also if you are using any of the Unity scripting APIs that are intended to be used to access network (even if you are using them for opening local files) Unity will add internet permission. Finally open "WIndow -> Package Manager" and check the packages that are included in your project. Some of the packages (such as ads or analytics) might be included by default, even if you have not included them yourself. Removing such packages would get rid of the permission.
     
  7. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,192
    Internet Access is set to "Auto" (there is no None or Don't enable options unfortunately).

    In U2019.3.0f6 I've only added the Input System 1.0.0 preview 4 package. Everything else is Unity default.

    upload_2020-1-31_13-13-47.png

    I use Visual Studio (not VS Code) so maybe I should uninstall the following:
    • Rider Editor
    • Test Framework
    • Unity Collaborate (assume this is editor only - not build related)
    • Visual Studio Code Editor
    What do you think?
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Those packages should not matter and should not cause the permission to be added. By any chance, are you building the development player? The development player has this permission to allow it to connect to profiling and debugging tools. If you are building the development player, then try to build a release player, that should remove the permission.
     
  9. BigScary

    BigScary

    Joined:
    Jun 4, 2014
    Posts:
    7
    After upgrading Unity, I had this along with the wifi multicast permission showing up. By removing several packages auto-added to my project by Unity (multiplayer, ads), I was able to resolve it.
     
  10. Woelfle

    Woelfle

    Joined:
    Jan 13, 2019
    Posts:
    4
    I have the same issue...have somebody solved it ?
    I have no Ads or Statistics implemented...
    many thanks
     
    Last edited: Sep 23, 2020
  11. StayThirsty

    StayThirsty

    Joined:
    Jul 6, 2013
    Posts:
    33
    @JuliusM I know this thread is old but I'm also having this issue.

    I uninstalled nearly every package.
    Ive tried adding a custom AndroidManifest.xml and removing the internet permission there with no luck.
    • Release build
    • Google Play Bundle is checked (can't upload to google play otherwise right?)
    • Internet Access is on Auto
    • There is no local file reading or writing
    Every release I put on Google Play shows the permission of Internet Access required when I don't need it at all.

    Using Unity 2020.1.2f1

    There seems to be a new issue whenever I'm using unity :(
     
  12. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,828
    There is a way to find out from where its getting added!
    1. Go to the gradle build folder (Temp/gradleOut/launcher/build/outputs/logs)
    2. Open manifest-merger-release-report.txt
    3. Search for "uses-permission#android.permission.INTERNET"

    Now you can see which manifest is actually adding the permission. Share that txt file to look into.
    Later we will see how to override that permissions with MaxSdk attribute or tools override option.
     
    drewjosh likes this.
  13. StayThirsty

    StayThirsty

    Joined:
    Jul 6, 2013
    Posts:
    33
    The manifest-merger-release-report.txt:
    Code (CSharp):
    1. uses-permission#android.permission.INTERNET
    2. ADDED from [:unityLibrary] ..\Temp\gradleOut\unityLibrary\build\intermediates\library_manifest\release\AndroidManifest.xml:15:5-67
    3.     android:name
    4.         ADDED from [:unityLibrary] ..\Temp\gradleOut\unityLibrary\build\intermediates\library_manifest\release\AndroidManifest.xml:15:22-64
    Still not sure where the permission came from but adding tools:node="remove" next to android.permission.INTERNET worked.
    it should look like:
    Code (CSharp):
    1.  
    2. <uses-permission android:name="android.permission.INTERNET" tools:node="remove" />
    3.  
    I used a custom AndroidManifest.xml by checking Custom Main Manifest in Player Settings > Publishing Settings
     
    Last edited: Nov 17, 2022
  14. drewjosh

    drewjosh

    Joined:
    Sep 24, 2019
    Posts:
    23
    Hello everyone, thanks for guiding me into the right direction. I'm elaborating an issue on the same problem.
    My Unity version: 2021.3.11f1 (Silicon)

    I have found that the Localization package of Unity (1.3.2) is adding the internet permission to the AndroidManifest.xml.

    @JuliusM Is this wanted? If yes, can you explain me please why this is necessary and if there is a way to deactivate it?

    That the permission comes from the Localization package was not visible in the manifest-merger-release-report.txt file (see below). I created a test project, built and analysed the APK with the APK Analyzer in Android Studio before and after installing the package:

    Before installation of Localization package
    Package Manager:
    before_localizationPackageInstall_packageManager.png
    Manifest:
    before_localizationPackageInstall_manifest.png

    After installation of Localization package
    Package Manager:
    after_localizationPackageInstall_packageManager.png
    Manifest:
    after_localizationPackageInstall_manifest.png


    @Voxel-Busters Thanks for the idea to check for the "manifest-merger-release-report.txt" file, but it only states:
    Code (CSharp):
    1. uses-permission#android.permission.INTERNET
    2. ADDED from /Users/pizzaoven/Projects/Testproject/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/src/main/AndroidManifest.xml:20:3-65
    3.     android:name
    4.         ADDED from /Users/pizzaoven/Projects/Testproject/Library/Bee/Android/Prj/Mono2x/Gradle/unityLibrary/src/main/AndroidManifest.xml:20:20-62
    I also want to note for other developers that I dint't find the gradle build folder at the from @Voxel-Busters indicated location "Temp/gradleOut", which might be due to another Unity version, depending on the Scripting Backend setting (Mono or IL2CPP, I tried both and it was always in other paths) or that I'm running Unity on macOS. I found it by searching the file name in the project folder.

    Cheers :)
     
  15. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,828
    Library/Bee/Android is the path for new versions of Unity.

    If it doesn't point to any other manifests, it means the final manifest file may be patched directly. Try doing a quick text search in localization plugin to confirm if it is from it. But wondering why it needs it (any translation feature available in that plugin)?