azesmway / react-native-unity

MIT License
254 stars 60 forks source link

EAS Android build failure #65

Open drbarber opened 1 year ago

drbarber commented 1 year ago

I am working on getting an android build to run with EAS. I currently can run the pipeline with iOS with no errors but with android I am getting this error. I have tried setting the NDK version manually but am still getting the same error..

RUN_GRADLEW] ExitCode: 4 Duration: 0s146ms [RUN_GRADLEW] ExitCode: 1 Duration: 0s0ms [RUN_GRADLEW] Build failed with 0 successful nodes and 0 failed ones [RUN_GRADLEW] Error: Internal build system error. BuildProgram exited with code 1. [RUN_GRADLEW] System.IO.FileNotFoundException: Could not load file or assembly 'Bee.Stevedore.Program, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. [RUN_GRADLEW] File name: 'Bee.Stevedore.Program, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' [RUN_GRADLEW] at Bee.Core.BuildProgramContext..ctor(String[] args, String buildTitle) [RUN_GRADLEW] at Unity.IL2CPP.Bee.IL2CPPExeCompileCppBuildProgram.BuildProgram.Main(String[] args, String currentDirectory) in /Users/bokken/build/output/unity/il2cpp/Bee/Unity.IL2CPP.Bee.IL2CPPExeCompileCppBuildProgram/BuildProgram.cs:line 28 [RUN_GRADLEW] at il2cpp.Compilation.InProcessBuildProgram.StartImpl(String workingDirectory, String[] arguments) in /Users/bokken/build/output/unity/il2cpp/il2cpp/Compilation/InProcessBuildProgram.cs:line 51 [RUN_GRADLEW] Error: Unity.IL2CPP.Building.BuilderFailedException: Build failed with 0 successful nodes and 0 failed ones [RUN_GRADLEW] Error: Internal build system error. BuildProgram exited with code 1. [RUN_GRADLEW] System.IO.FileNotFoundException: Could not load file or assembly 'Bee.Stevedore.Program, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. [RUN_GRADLEW] File name: 'Bee.Stevedore.Program, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' [RUN_GRADLEW] at Bee.Core.BuildProgramContext..ctor(String[] args, String buildTitle) [RUN_GRADLEW] at Unity.IL2CPP.Bee.IL2CPPExeCompileCppBuildProgram.BuildProgram.Main(String[] args, String currentDirectory) in /Users/bokken/build/output/unity/il2cpp/Bee/Unity.IL2CPP.Bee.IL2CPPExeCompileCppBuildProgram/BuildProgram.cs:line 28 [RUN_GRADLEW] at il2cpp.Compilation.InProcessBuildProgram.StartImpl(String workingDirectory, String[] arguments) in /Users/bokken/build/output/unity/il2cpp/il2cpp/Compilation/InProcessBuildProgram.cs:line 51 [RUN_GRADLEW] at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, Il2CppCommandLineArguments il2CppCommandLineArguments, BuildingOptions buildingOptions, Boolean throwExceptions) in /Users/bokken/build/output/unity/il2cpp/il2cpp/Program.cs:line 331 [RUN_GRADLEW] w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions [RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. [RUN_GRADLEW] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. [RUN_GRADLEW] See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings [RUN_GRADLEW] Execution optimizations have been disabled for 8 invalid unit(s) of work during this build to ensure correctness. [RUN_GRADLEW] Please consult deprecation warnings for more details. [RUN_GRADLEW] 638 actionable tasks: 638 executed [RUN_GRADLEW] FAILURE: Build completed with 2 failures. [RUN_GRADLEW] 1: Task failed with an exception. [RUN_GRADLEW] ----------- [RUN_GRADLEW] Where: [RUN_GRADLEW] Build file '/private/var/folders/_c/8s_8cjg15bx1mcvz3_rd6w5w0000gn/T/eas-build-local-nodejs/96ec36db-1cea-4d87-9e9e-13c80c0fbb4d/build/unity/builds/android/unityLibrary/build.gradle' line: 78 [RUN_GRADLEW] What went wrong: [RUN_GRADLEW] Execution failed for task ':unityLibrary:BuildIl2CppTask'. [RUN_GRADLEW] > Process 'command '/private/var/folders/_c/8s_8cjg15bx1mcvz3_rd6w5w0000gn/T/eas-build-local-nodejs/96ec36db-1cea-4d87-9e9e-13c80c0fbb4d/build/unity/builds/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp'' finished with non-zero exit value 4 [RUN_GRADLEW] Try: [RUN_GRADLEW] > Run with --stacktrace option to get the stack trace. [RUN_GRADLEW] > Run with --info or --debug option to get more log output. [RUN_GRADLEW] > Run with --scan to get full insights. [RUN_GRADLEW] ============================================================================== [RUN_GRADLEW] 2: Task failed with an exception. [RUN_GRADLEW] ----------- [RUN_GRADLEW] What went wrong: [RUN_GRADLEW] java.lang.StackOverflowError (no error message) [RUN_GRADLEW] Try: [RUN_GRADLEW] > Run with --stacktrace option to get the stack trace. [RUN_GRADLEW] > Run with --info or --debug option to get more log output. [RUN_GRADLEW] > Run with --scan to get full insights. [RUN_GRADLEW] ============================================================================== [RUN_GRADLEW] Get more help at https://help.gradle.org/ [RUN_GRADLEW] BUILD FAILED in 2m 50s [RUN_GRADLEW] Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Build failed Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information. Error: npx exited with non-zero code: 1

linaia commented 1 year ago

Do you build on OSX ? Check that the Security and Confidentiality in System Preferences requested the access to the files (you have many files to allow one by one.... after all is allowed it can build ;)

SethCram commented 1 year ago

To EAS build for Android, I had to initiate and build everything from Linux, I think because the runner uses Linux. It never worked from my Windows machine despite my best efforts. It would always throw the same cryptic error message of

[stderr] Execution failed for task ':unityLibrary:BuildIl2CppTask'.

[stderr] > A problem occurred starting process 'command '/home/expo/workingdir/build/todo-list/unity/builds/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp''

If anyone knows how to EAS build for Android from a Windows machine without WSL, please let me know.

To get EAS build working, I followed these steps on my Windows machine

  1. Install WSL2
  2. Install the Gnome Text Editor
  3. Install and open a Browser, making it the default
  4. Download, open, and login to the Unity Hub using the Browser
  5. Download Unity version
  6. Download Android Studio and unzip to /usr/local
  7. Install NDK and SDK API Level
    1. Simulator doesn't require setup because it's not needed
  8. Create an environment variable file and make sure it runs on WSL startup
    1. sudo nano ~/.bash_profile
    2. Include the following variables with the proper username
      export ANDROID_HOME=/home/<username>/Android/Sdk
      export ANDROID_NDK_HOME=/home/<username>/Android/Sdk/ndk/21.3.6528147
      export JAVA_HOME=/usr/local/android-studio/jbr
    3. source ~/.bash_profile
  9. Install the project
    git clone <githubProjectURL>
  10. Setup the dependencies
    1. Install Node.js
    2. Run npm install in the proper directory
  11. Open the project in Unity
  12. Select Platform as Android > Switch Platform
    1. Export Project
    2. Export to unity/builds/android
  13. EAS build the project
    1. Server build: eas build --platform android
    2. Local build: eas build --platform android --local