Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question where is the android manifest?

Discussion in 'Android' started by Marks4, Feb 2, 2022.

  1. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    566
    This link says that the resulting android manifest is at the folder Temp/StagingArea/AndroidManifest.xml. It's not. I can't find it anywhere. Where is the resulting AndroidManifest.xml from the build?? See picture below, there is no AndroidManifest. Using Unity 2021.1. Thank you.
     

    Attached Files:

  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    If you need the final "Merged" AndroidManifest xml file you can look for the below path (Assuming you are >= 2019.3)
    On another note, wondering where you found that image link shared in your post. That sounds like the path from < 2019.3. If you can share the source, we can update with the latest details too :)
     

    Attached Files:

    dhlee2 likes this.
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    Export Android Studio project from Unity and you'll find manifest in it.
     
  4. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    566
    Wut? Android Studio? I don't use Android Studio. What does Android Studio has to do with Unity? I don't care about it.

    Ok thanks. You're not talking about the androidmanifest of your plugin right? I'm not talking about the androidmanifest of voxelbusters. I'll check the path you provided. Also, the image provided is from a Unity 2021.1 build on a mac.
     
  5. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    Nope. It's the path in general for "Merged" manifest file. You get Temp/gradleOut folder once you make an apk from unity.
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    You want Android manifest file generated by Unity?
    Exported project will have it and you won't need to go through temp folder searching for it. And you don't need Android Studio itself.
     
  7. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    Yes, As @Aurimas-Cernius mentioned, you can access the same file by exporting as android project too from build settings. Both will have same content.

    I was just trying to point the file what unity (gradle) generates during its build process.
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    It's not gradle generated file. The exported project still has multiple manifests.
    If you want the truly final merged manifest, you need to build apk and decompile it.
    Here I assumed you want to get the main manifest Unity generates so you can base your own template on it.
     
  9. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    566
    Ok....so the reason I'm asking where's the android manifest is because I'm having the issue described here. Some dude says that I can edit the androidmanifest found at /Temp/StagingArea/AndroidManifest.xml . I also found this information on Unity's documentation. Then I copy the edited manifest to plugins/android to overwrite the manifest.

    How can I do this after all? There is no AndroidManifest in the StagingArea...is the documentation outdated?
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    For such purpose certainly do export a project and you'll find all manifests in there.

    Am I correct that you refer to this page?
    Yeah, it's out of date, I'll open bug report to update it. Not only there is more than one manifest since Unity as a Library introduction, but also since project export exists it's ridiculous to tell people to catch some temp files before Unity deletes them :(
     
    Voxel-Busters likes this.
  11. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    While Manifest merger (jar) is part of android sdk tools, Gradle build process (during process manifest task) triggers it and generates the merged manifest by combining all manifests. We can even disable it through gradle task. Anyways...

    True. There will be multiple manifest files in the exported Android project. I could we wrong in the wording.
    However you can still see the "final Merged" Manifest from the Merged Manifest view of Android studio IDE.


    No, Actually I'm trying to point him at the final merged manifest. Let me list down different ways so that it will be more clear for others to get "final merged manifest" file.

    1. Export an apk/aab and find the merged manifest in Temp/gradleOut/launcher/build/intermediates/merged_manifests/[debug|release]/AndroidManifest.xml
    or
    2. Export as android project and open the project in Android Studio, click an AndroidManifest.xml file and select Merged Manifest tab
    or
    3. Export an apk from unity or from android project(through Android Studio or gradle tasks from cli) and decompile it with a tool like jadx

    Ok. From your post I see that you actually don't need the merged manifest but the main manifest.
    For adding the meta-data tag, you can simply click on "Custom Main Manifest" option and update the generated AndroidManifest.xml under Assets/Plugins/Android folder.
     

    Attached Files:

    Last edited: Mar 27, 2024
  12. Quawetim-Inf

    Quawetim-Inf

    Joined:
    Mar 10, 2020
    Posts:
    10
    This is a very bad suggestion, assuming to build manually every time instead of using an automatic build system. Why we just can't get final manifest to edit it just before APK build? Google likes to change rules for features and permissions, i.e. for ChromeOS we must delete some features and permissions that UNITY generates atomatically. Export a project, edit manifest and build from Android Studio - definetly not an option. As full code refactoring for one beta platform.
     
  13. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    You can make use of IPostGenerateGradleAndroidProject callbacks to modify the manifest files.
     
  14. Quawetim-Inf

    Quawetim-Inf

    Joined:
    Mar 10, 2020
    Posts:
    10
  15. Ragoline

    Ragoline

    Joined:
    Nov 27, 2018
    Posts:
    1
    I couldn't find the Manifest file until I made an .apk. Used to only build .aab so there wasn't an AndroidManifest.xml. Also I had to open a few more folders to find it. It wasn't just Temp/StagingArea/
    It hasn't helped me solve the problem, though :(
     
  16. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,027
    Newer unity versions save it in Library/bee/....
     
    BjoUnity3d and Fpaciello like this.
  17. ShayneK

    ShayneK

    Joined:
    Jan 19, 2017
    Posts:
    13
  18. Oddpetrichor

    Oddpetrichor

    Joined:
    Jan 20, 2021
    Posts:
    4
    Hi! very old issue here but maybe someone find it useful.
    You can go to Player Settings -> Player -> Publishing Settings -> Build-> Custom Main Manifest (check).
    Now you can go in Project Assets\Plugins\Android\AndroidManifest.xml and edit the file.