juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 505 forks source link

The application crashes when the app try to build UnityWidget. #884

Open ChurikiTenna opened 9 months ago

ChurikiTenna commented 9 months ago

Describe the bug

App crashes when it try to show UnityWidget below.

UnityWidget(
            onUnityCreated: onUnityCreated,
            onUnityMessage: onUnityMessage,
            onUnitySceneLoaded: onUnitySceneLoaded,
            fullscreen: false,
            printSetupLog: false)

This has never happened before though.

Log:

...
[        ]       #133 pc 0000000000553530  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*,
std::__va_list)+112) (BuildId: 3cd43dfd934282c944e52afdac5120fb)
[        ]       #134 pc 00000000000c0ce8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+120) (BuildId:
adaff87eb38d1f1656cbc504539d7ceb)
[        ]       #135 pc 00000000000cd444  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&,
bool)+852) (BuildId: adaff87eb38d1f1656cbc504539d7ceb)
[        ]       #136 pc 0000000000002574  /system/bin/app_process64 (main+1300) (BuildId: 2b60f9748c99330a43e8a5f1f84b8bcc)
[        ]       #137 pc 0000000000084d70  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: 223ef8d5f0fe5d949ebf7e38286d3677)
[ +106 ms] Service protocol connection closed.
[        ] Lost connection to device.
[        ] DevFS: Deleting filesystem on the device (file:///data/user/0/com.euphopia.ai_chara/code_cache/ai_charaTEXOSE/ai_chara/)
[ +253 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed

[   +2 ms] "flutter run" took 52,111ms.
[ +119 ms] ensureAnalyticsSent: 116ms
[        ] Running 1 shutdown hook
[   +9 ms] Shutdown hooks complete
[        ] exiting with code 0

To Reproduce

  1. Export Android (Release)
  2. change build.gradle -> BuildIl2Cpp to
    def commandLineArgs = []
    commandLineArgs.add("--compile-cpp")
    commandLineArgs.add("--platform=Android")
    commandLineArgs.add("--architecture=" + architecture)
    commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so")
    commandLineArgs.add("--libil2cpp-static")
    commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi)
    commandLineArgs.add("--incremental-g-c-time-slice=3")
    commandLineArgs.add("--configuration=" + configuration)
    //commandLineArgs.add("--dotnetprofile=unityaot-linux")
    //commandLineArgs.add("--enable-debugger")
    //commandLineArgs.add("--profiler-report")
    //commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents")
    commandLineArgs.add("--print-command-line")
    commandLineArgs.add("--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/external/bdwgc/include")
    commandLineArgs.add("--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/libil2cpp/include")
    commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput")
    commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache")
    commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory)
    staticLibraries.eachWithIndex {fileName, i->
        commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName)
    }
  3. flutter run

Expected behavior Run the app

Unity (please complete the following information):

Smartphone (please complete the following information):