Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase builds and Android - (ios references and python missing from Android images) #100

Closed
SilkyPants opened this issue Mar 30, 2021 · 19 comments · Fixed by #160
Closed
Labels
enhancement New feature or request

Comments

@SilkyPants
Copy link

Context
Due to the nature of some projects - it might be quicker to combine and download a single image that contains both the Android and iOS modules. This would also help address builds that require the use of the UnityEditor.iOS.Extensions.Xcode reference (which seems to be a common thing if you integrate with Firebase/Google libraries)

googlesamples/unity-jar-resolver#412

Suggested solution
Create a new image with the module type mobile or possibly android-ios if this would mean there is less work for the remainder of the build scripts. This image would contain both the Android and iOS modules installed.

Considered alternatives
None I can think of

Additional details
Ideally, this would not be required, but due to the later versions of Unity being stricter with the reference inclusion this silently breaks apps as the required libraries are disabled during the build process. It appears Google is working on their issue, though I could see a benefit for a combined base image in the future for cross mobile platform builds.

Assembly 'Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll' will not be loaded due to errors:
Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.

Assembly 'Assets/Firebase/Editor/Firebase.Crashlytics.Editor.dll' will not be loaded due to errors:
Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.

Assembly 'Assets/Firebase/Editor/Firebase.Editor.dll' will not be loaded due to errors:
Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
@webbertakken
Copy link
Member

it might be quicker to combine and download a single image that contains both the Android and iOS modules.

For very small projects or a very slow data connection this could be true - in which case there is the solution of self-hosted runners. We have consciously chosen against this because it eliminates our preference for parallelization. The bottleneck is usually not in the downloading of the image (which would even be substantially bigger in the suggested approach) but the build process itself - especially concerning CPU time. Parallelisation is important for by far most cases that we know of.

Please note that in the opening post the problem is not described clearly - just the solution. This makes it harder to think along. Could you please elaborate on the problem we're trying to solve here? Is it about later versions of Unity being stricter with the reference inclusion or Due to the nature of some projects?

some projects

Could you speak further for the actual use case that would make this preferable?

@SilkyPants
Copy link
Author

Sorry for the confusion - I was not meaning to build both iOS and Android in the same build step, and agree that a preference for parallelization is definitely worth while.

The specific issue I have faced is when including the Firebase libraries I get the above errors. This is something that Google is working on trying to solve, but from what I have managed to find it could be tricky or not possible - as the required preprocessor commands to exclude the iOS libraries cannot be run for their final package. This is where I was mentioning 'some projects' and on reading back should have been a lot clearer - this is a problem with any Android project that includes an external library with iOS code included, where I might see a lot of them including the Firebase or other Google libraries.

The current workaround for this issue is to include the iOS module in the Unity - regardless of if it is being used. This looks to be an issue with the newer 2020 versions of Unity as pointed out in this comment, where I can only assume in the earlier versions it might have been a silent warning instead of an error.

For us - I am still looking into this issue on the side, as there may be other workarounds as well as getting myself more familiar with the Dockerimage process. Will update if I find anything worth while

@SilkyPants
Copy link
Author

SilkyPants commented Apr 6, 2021

I may have found a workaround for now - buried in the plugin settings you can Disable the validation (didn't understand that error properly to see that option).

image

The next problem seems to be that python is not included in the Android image? Is this to be expected?

Unable to find command line tool python required for Firebase Android resource generation.
python is required to generate the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist. Without Firebase Android resources, your app will fail to initialize.
python was distributed with each Firebase Unity SDK plugin, was it deleted?

I have also updated the issue to better reflect the issue that's happening here, for others to find.

EDIT: Added image to illustrate the option

@SilkyPants SilkyPants changed the title Combined Android/iOS docker image Firebase builds and Android - UnityEditor.iOS.Extensions.Xcode errors disable Firebase Apr 6, 2021
@davidmfinol
Copy link
Member

Currently, python is only included on webGL and linux-IL2CPP.
Maybe we should also include python on Android in order to support this?

@jklingsporn
Copy link

Yes, please. However if there is a known workaround, I'd give it a try.

@SilkyPants
Copy link
Author

Argh - I fogot to update >.<

I did have a bit of a workaround (at least for my situation). It's pretty much installing Python before running my build scripts with apt install python -y. This is working fine for us at the moment, though having python inluded in the Docker image would be great.

@webbertakken
Copy link
Member

Currently, python is only included on webGL and linux-IL2CPP.
Maybe we should also include python on Android in order to support this?

Accepting a PR for this.

@davidmfinol davidmfinol changed the title Firebase builds and Android - UnityEditor.iOS.Extensions.Xcode errors disable Firebase Firebase builds and Android - (ios references and python missing from Android images) Aug 3, 2021
@davidmfinol davidmfinol added the enhancement New feature or request label Aug 3, 2021
@dharmeshmp
Copy link
Contributor

I am facing the same issue in Unity 2021.2.8 and Image version 0.16

Before upgrade the version its working fine for me
Older version is 2021.1.20f1 and Image version 0.15

Screenshot 2022-01-21 at 6 41 43 PM

@mastef
Copy link

mastef commented Jan 27, 2022

Would be amazing to have a simple symlink in the docker images. Either installing python 2 with RUN apt install python -y or simply adding RUN ln -s /usr/bin/python3 /usr/bin/python in the end

@webbertakken
Copy link
Member

Can we assume that by now it's ok to go with Python 3 only and use your second suggestion?

We're open to PRs with your suggested changes.

@davidmfinol
Copy link
Member

davidmfinol commented Feb 25, 2022

We went with adding RUN ln -s /usr/bin/python3 /usr/bin/python for certain platforms.

Do you all think this issue is resolved, or should we try to expand and add python to all target platforms like @mastef suggested in #152 ?

@webbertakken
Copy link
Member

As Python3 is 22 megs (compared to 2GB that we're pulling already, at a minimum) and installing it solves a category of problems like those of Firebase, I would suggest that we install it on all platforms by installing it in the base image - simplifying the Dockerfile per-platform snippets.

What do you think?

@mastef
Copy link

mastef commented Feb 27, 2022

@webbertakken you can also solve it by just installing python ( not python3 ) and simplifying the step. As I saw another build step was also installing python and python-buildtools. So installing python in the base image would benefit many configs.

@webbertakken
Copy link
Member

Thank you for your input @mastef

By "just installing python" do you mean installing python 2 instead of 3? And wouldn't that mean we'd have to upgrade again at some point in the future?

@dharmeshmp
Copy link
Contributor

@webbertakken

Ubuntu image ubuntu:18.04 (which we are using in the base image) is already come with python3 preinstalled. But firebase is trying to use python, That's why we have created just symlink to fix the issue.

@webbertakken
Copy link
Member

Ah check. In that case I suggest we make that symlink in the base image and remove links and installs elsewhere.

@GabLeRoux
Copy link
Member

There’s a package called python3-is-python that does exactly this. Here’s a related discussion:
https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3

Haven’t tried it in a docker image yet

@webbertakken
Copy link
Member

Please review. #160

Could any firebase user manually build the image to see if it works for you? Then we can roll this out for everyone.

@webbertakken
Copy link
Member

@webbertakken

Ubuntu image ubuntu:18.04 (which we are using in the base image) is already come with python3 preinstalled. But firebase is trying to use python, That's why we have created just symlink to fix the issue.

This turned out to not be true. It has Python2 installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants