firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
836 stars 429 forks source link

Error loading Python DLL (Generation of the Firebase Android resource file failed) #540

Closed pedicagames closed 4 years ago

pedicagames commented 4 years ago

Unity editor version: 2019.2.17f1 Firebase Unity SDK version: Version 6.8.1 Firebase plugins in use (Auth, Database, etc.): Analytics Additional SDKs you are using (Facebook, AdMob, etc.): Admob, Goggle Play Services Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows 7 Ultimate SP1 Platform you are targeting (iOS, Android, and/or desktop): Android Scripting Runtime (Mono, and/or IL2CPP):IL2CPP

1) I created empty project (Nothing in there. Only test for firebase, admob, GPGS and sample code from firebase.google.com) 2) I downloaded goggle-services.json file from console. 3) When I start to Unity then I got this error:

Generation of the Firebase Android resource file google-services.xml from Assets/google-services.json failed. If you have not included a valid Firebase Android resources in your app it will fail to initialize.

D:/Project Unity/Unity Test (Published)/Assets\..\Assets/Firebase/Editor/generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l.

Error loading Python DLL: C:\Users\sadrag\AppData\Local\Temp\_MEI105202\python27.dll (error code 14001)

4) And real-time statistics not working on the console. 5) I do not receive this error in version 6.7.0.

google-oss-bot commented 4 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

stewartmiles commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader.

From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29

We're going to try rebuilding the script using the suggested flags.

abasov90 commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader.

From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29

We're going to try rebuilding the script using the suggested flags.

Installing Microsoft Visual C ++ 2008 Redistributable Package did not help

pedicagames commented 4 years ago

Also, I tried it on a computer with windows 10 installed and did not receive the error.

mtemnikov commented 4 years ago

Same error. Can't even run Firebase in my game due to this error:

"Generation of the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist failed. If you have not included a valid Firebase Android resources in your app it will fail to initialize. D:/UnityProjects/MSO_2018.3/Assets\..\Assets/Firebase/Editor/generate_xml_from_google_services_json.exe -i "Assets/GoogleService-Info.plist" -l --plist.

Microsoft.VC90.CRT.manifest could not be extracted! "

Windows 8.1 (tried on Win10 - the same) Unity editor version: 2018.4.6f1 Firebase Unity SDK version: Version 6.8.1 GPGS ver 0.10.06

Also, tried to install Microsoft Visual C ++ 2008 Redistributable Package. The same problem still exist

abasov90 commented 4 years ago

@stewartmiles Any news?

mtemnikov commented 4 years ago

@stewartmiles Any news?

Actually i moved into Win 10 and error has gone

shareyourlocationsite commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader.

From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29

We're going to try rebuilding the script using the suggested flags.

Did you test it on Windows 7? Still got this problem.

bmateus commented 4 years ago

I'm on Windows 7 and had the same problem. I have Python 2.7.9 installed and on the system path. To fix the problem I had to add: import ctypes.wintypes to generate_xml_from_google_services_json.py and then rebuilt the exe with: pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py worked fine after that

ankhotep commented 4 years ago

I'm on Windows 7 and had the same problem. I have Python 2.7.9 installed and on the system path. To fix the problem I had to add: import ctypes.wintypes to generate_xml_from_google_services_json.py and then rebuilt the exe with: pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py worked fine after that

Hi! Actually im desperate trying to figure out, how to generate the .py file, after imported ctypes.wintypes in python. I mean, I opened the console (shell), typed, "import ctypes.wintypes", and then, I dont know what else to do. I've tryed running the py file, but has no success.. Could you please , PLEASE help me.

Much appreciated. I can send you a beer after your great help. I've been surfing for answers, and this is my fifth day strugglin, the beer thing is very serious. Thanks :D

ankhotep commented 4 years ago

This is the output from an attemp to run the py file.

C:\Users\Valcion2>pyinstaller --clean --win-private-assemblies -F "C:\Users\Valcion2\Desktop\Proyectos\Valcion\aMatchs\Assets\Firebase\Editor\generate_xml_ from_google_services_json.py" 188 INFO: PyInstaller: 3.5 188 INFO: Python: 3.8.1 189 INFO: Platform: Windows-7-6.1.7601-SP1 191 INFO: wrote C:\Users\Valcion2\generate_xml_from_google_services_json.spec 193 INFO: UPX is not available. 194 INFO: Removing temporary files and cleaning cache in C:\Users\Valcion2\AppDa ta\Roaming\pyinstaller 197 INFO: Extending PYTHONPATH with paths ['C:\\Users\\Valcion2\\Desktop\\Proyectos\\Valcion\\aMatchs\\Assets\\Fireba se\\Editor', 'C:\\Users\\Valcion2'] 198 INFO: checking Analysis 199 INFO: Building Analysis because Analysis-00.toc is non existent 201 INFO: Initializing module dependency graph... 205 INFO: Initializing module graph hooks... 209 INFO: Analyzing base_library.zip ... 7044 INFO: Processing pre-find module path hook distutils 11609 INFO: running Analysis Analysis-00.toc 11613 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by c:\users\valcion2\appdata\local\programs\python\python38-32\python .exe 12186 INFO: Caching module hooks... 12204 INFO: Analyzing C:\Users\Valcion2\Desktop\Proyectos\Valcion\aMatchs\A ssets\Firebase\Editor\generate_xml_from_google_services_json.py 12338 INFO: Loading module hooks... 12339 INFO: Loading module hook "hook-distutils.py"... 12355 INFO: Loading module hook "hook-encodings.py"... 12491 INFO: Loading module hook "hook-lib2to3.py"... 12499 INFO: Loading module hook "hook-pydoc.py"... 12519 INFO: Loading module hook "hook-sysconfig.py"... 12529 INFO: Loading module hook "hook-xml.etree.cElementTree.py"... 12531 INFO: Loading module hook "hook-xml.py"... 12631 INFO: Loading module hook "hook-_tkinter.py"... 12864 INFO: checking Tree 12865 INFO: Building Tree because Tree-00.toc is non existent 12867 INFO: Building Tree Tree-00.toc 13255 INFO: checking Tree 13256 INFO: Building Tree because Tree-01.toc is non existent 13256 INFO: Building Tree Tree-01.toc 13370 INFO: Looking for ctypes DLLs 13461 INFO: Analyzing run-time hooks ... 13469 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' 13492 INFO: Including run-time hook 'pyi_rth__tkinter.py' 13506 INFO: Looking for dynamic libraries 13959 INFO: Looking for eggs 13960 INFO: Using Python library c:\users\valcion2\appdata\local\programs\python \python38-32\python38.dll 13963 INFO: Found binding redirects: [] 13977 INFO: Warnings written to C:\Users\Valcion2\build\generate_xml_from_google _services_json\warn-generate_xml_from_google_services_json.txt 14152 INFO: Graph cross-reference written to C:\Users\Valcion2\build\generate_xm l_from_google_services_json\xref-generate_xml_from_google_services_json.html 14255 INFO: checking PYZ 14256 INFO: Building PYZ because PYZ-00.toc is non existent 14257 INFO: Building PYZ (ZlibArchive) C:\Users\Valcion2\build\generate_xml_from _google_services_json\PYZ-00.pyz Traceback (most recent call last): File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\runpy.py ", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\runpy.py ", line 86, in _run_code exec(code, run_globals) File "C:\Users\Valcion2\AppData\Local\Programs\Python\Python38-32\Scripts\pyin staller.exe\__main__.py", line 9, in <module> File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\build_main.py", line 844, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build' )) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\build_main.py", line 791, in build exec(code, spec_namespace) File "C:\Users\Valcion2\generate_xml_from_google_services_json.spec", line 18, in <module> pyz = PYZ(a.pure, a.zipped_data, File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\api.py", line 98, in __init__ self.__postinit__() File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\datastruct.py", line 158, in __postinit__ self.assemble() File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\api.py", line 128, in assemble self.code_dict = { File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\api.py", line 129, in <dictcomp> key: strip_paths_in_code(code) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code consts = tuple( File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\utils.py", line 653, in <genexpr> strip_paths_in_code(const_co, new_filename) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code consts = tuple( File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\utils.py", line 653, in <genexpr> strip_paths_in_code(const_co, new_filename) File "c:\users\valcion2\appdata\local\programs\python\python38-32\lib\site-pac kages\PyInstaller\building\utils.py", line 660, in strip_paths_in_code return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_ stacksize, TypeError: an integer is required (got type bytes)

ankhotep commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader.

From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29

We're going to try rebuilding the script using the suggested flags.

Hello and thanks for the help. Could you please show me how you did it? wrap the installer using pyinstaller? Any tutorial, hint, advice will be great help. thank you all guys. This thread gave me color once again. I was pulling my hair out!

askrylev commented 4 years ago

I'm on Windows 7 and had the same problem. I have Python 2.7.9 installed and on the system path. To fix the problem I had to add: import ctypes.wintypes to generate_xml_from_google_services_json.py and then rebuilt the exe with: pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py worked fine after that

Thank you. This solution is what fixed my issue.

I do have Py27 and 38 so i had to make sure i did all of this in Py27 because 38 is a total no go.

askrylev commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader. From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29 We're going to try rebuilding the script using the suggested flags.

Hello and thanks for the help. Could you please show me how you did it? wrap the installer using pyinstaller? Any tutorial, hint, advice will be great help. thank you all guys. This thread gave me color once again. I was pulling my hair out!

The solution was posted by bmateus https://github.com/firebase/quickstart-unity/issues/540#issuecomment-571166845

To give some details. 1) make sure your "Path" environment variable contains your python 2.7 folder and scripts folder. Something like -> C:\Python27\Scripts\;C:\Python27\; 2) create a separate empty folder and copy generate_xml_from_google_services_json.py from \Assets\Firebase\Editor\ into the newly created folder 3) open generate_xml_from_google_services_json.py and add "import ctypes.wintypes" after other imports like "from xml.etree import ElementTree" 4) start cmd and navigate to newly created folder 5) type "pip install pyinstaller" it should show some text on the screen and by the end will install pyinstaller prerequisites 6) execute following command "pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py" 7) above step should generate a "dist" folder which will contain a new .exe file, Copy this file overriding the one in \Assets\Firebase\Editor\ 8) Run your project, observe that error is gone 9) go to https://github.com/firebase/quickstart-unity/issues/540#issuecomment-571166845 and thank bmateus for a solution

This is max level of detail on what to do :) I cannot explain it any simpler. Cheers.

stewartmiles commented 4 years ago

Folks, we're going to try out https://github.com/firebase/quickstart-unity/issues/540#issuecomment-571166845 for the prebuilt .exe. Windows 7 is end of life (EOL) so our machines are all Win10 though and Python 2.x is also EOL so we'll be building with Python 3.x.

ankhotep commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader. From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29 We're going to try rebuilding the script using the suggested flags.

Hello and thanks for the help. Could you please show me how you did it? wrap the installer using pyinstaller? Any tutorial, hint, advice will be great help. thank you all guys. This thread gave me color once again. I was pulling my hair out!

The solution was posted by bmateus #540 (comment)

To give some details.

  1. make sure your "Path" environment variable contains your python 2.7 folder and scripts folder. Something like -> C:\Python27\Scripts;C:\Python27;
  2. create a separate empty folder and copy generate_xml_from_google_services_json.py from \Assets\Firebase\Editor\ into the newly created folder
  3. open generate_xml_from_google_services_json.py and add "import ctypes.wintypes" after other imports like "from xml.etree import ElementTree"
  4. start cmd and navigate to newly created folder
  5. type "pip install pyinstaller" it should show some text on the screen and by the end will install pyinstaller prerequisites
  6. execute following command "pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py"
  7. above step should generate a "dist" folder which will contain a new .exe file, Copy this file overriding the one in \Assets\Firebase\Editor\
  8. Run your project, observe that error is gone
  9. go to #540 (comment) and thank bmateus for a solution

This is max level of detail on what to do :) I cannot explain it any simpler. Cheers.

This worked flawlessly, Thanks for all your help guys!! ♥

stewartmiles commented 4 years ago

@alexames is working on a release which incorporates an updated change. You'll still need to install the Universal C Runtime on Win 7/8 https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows though. Also, there is a fallback path in the new plugin that will launch the script using a python installation on you machine - if you have one - so you can delete the .exe file and it will run the .py instead.

pseudocolor commented 4 years ago

We use pyinstaller to wrap the generate_xml_from_google_services_json.py script in a loader. From https://stackoverflow.com/questions/32457341/pyinstaller-and-onefile-build-causes-error-loading-python-dll-error-code-14001 it looks like some folks are running into this sort of thing due to a missing MSVC runtime. Some folks suggest installing https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29 We're going to try rebuilding the script using the suggested flags.

Hello and thanks for the help. Could you please show me how you did it? wrap the installer using pyinstaller? Any tutorial, hint, advice will be great help. thank you all guys. This thread gave me color once again. I was pulling my hair out!

The solution was posted by bmateus #540 (comment)

To give some details.

  1. make sure your "Path" environment variable contains your python 2.7 folder and scripts folder. Something like -> C:\Python27\Scripts;C:\Python27;
  2. create a separate empty folder and copy generate_xml_from_google_services_json.py from \Assets\Firebase\Editor\ into the newly created folder
  3. open generate_xml_from_google_services_json.py and add "import ctypes.wintypes" after other imports like "from xml.etree import ElementTree"
  4. start cmd and navigate to newly created folder
  5. type "pip install pyinstaller" it should show some text on the screen and by the end will install pyinstaller prerequisites
  6. execute following command "pyinstaller --clean --win-private-assemblies -F generate_xml_from_google_services_json.py"
  7. above step should generate a "dist" folder which will contain a new .exe file, Copy this file overriding the one in \Assets\Firebase\Editor\
  8. Run your project, observe that error is gone
  9. go to #540 (comment) and thank bmateus for a solution

This is max level of detail on what to do :) I cannot explain it any simpler. Cheers.

this save me big time, thanks!

stewartmiles commented 4 years ago

Folks we fixed issues with this as best in 6.9.0 (latest rev is 6.10.0) as we can at the moment by adding python 3 support, changing pyinstaller and adding a fallback to launch the .py script if the .exe is causing issues.

Could folks give this a try and if there are issues we can reopen the bug?