-
Notifications
You must be signed in to change notification settings - Fork 529
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
Closing unity screen and relaunching it crashes the app #46
Comments
All I could do for now is to prevent the unity player from quitting on disposing by removing UnityUtils.getPlayer().quit(); from the library dispose method in android. |
@TarekMedhat looking into it |
I think your logs are a red herring, as it points towards this: https://stackoverflow.com/questions/51959096/no-implementation-found-for-void-com-unity3d-player-unityplayer-nativerestartact Are you sure you're using the |
I think I saw similar bug, I'm looking into it |
I've got similar problem, but i got another error: steps:
|
Seems like UnityPlayer.quit() also kills the app it's running in. We might need to take a look at the newest version of Unity as a Library (https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app-version-2.751712/) which added a UnityPlayer.unload() method to address this exact issue. |
I reviewed this error and the problem is the onDestroy() method of the UnityPlayer class. And exactly this piece of code:
To solve this problem, you need to create MainUnityActivity in a separate process :) Then the .quit() method will only kill this process. How can you try to fix it: Maybe something of this will be helpful :) |
Hi, Just wondering if you will be merging a solution for this into the plugin in the near future? |
I have tried changing UnityUtils.getPlayer().quit to unload() instead and it stops the the activity from being disposed, however I get a black screen when launching the widget again, so I assume more needs to be handled as what I did only handles one part. Would you know what else I would need to do to clear up the widget to be able to use it again in a clean fashion? Thanks |
@RomanTechnologies Yeah, same here. After reading about it, I have also attempted to add the below in the manifest, but no luck :(
I can't tell if this is an issue with the Unity's android library or the plugin's? Or both 🙃 |
@assemmarwan Yeah I have done the same, so when disposing of the widget it doesnt close the activity. This is all due to the library needing to update the .quit() method to unload() as unity added this specifically due to the issues on android. I have done that but it needs more work so I will wait until the authors have a clean solution merged in. |
Hi, feel free to experiment or create a pull request. I've tried switching to .unload() instead of .quit(), but saw similar issues (black screen, seemingly not properly re-instantiating the Unity app). Even so, your solution might be more clean than mine (if I ever come up with one), so we're always open for pull requests! |
@thomas-stockx Thanks for getting back to us. Great, if I ever figure out a solution I will open a pull request. |
Hi, is there a solution yet? I actually never encountered this issue, till I needed to reinstall windows, and suddenly, it would crash after changing screens through a BottomNavBar... I tried to recreate the old state (manually redownloading old versions, ...), but can't get it to work anymore. Log :
The errors are not new BTW. EDIT :
indicates the unity window pausing, at least for me. |
Any update for this? |
Also I'm looking any info about this, how to close the unity app safely without crashing the app |
I'm also have the same problem as you |
I'm having trouble when changing from screen and open again the unity screen it crash. Any idea on how to solve this on android? |
@Darkmax Temporarily you can try the below until a root solution/fix is implemented.
|
@assemmarwan |
Ok I resolve my own issue, I just have to modified the yaml to point to the modified plugin that I download from @assemmarwan , I hope soon someone fix this problem. but for now this resolve the issue like @assemmarwan said, one can handle this kind of things via messages. thanks |
Hi, I remember that use the same solution: In my app the user should be can change between 3D and AR view. Problem 1: Problem 2: I'll retake the project with the possible solution for problem 1 and share the result of the test. Regards! 🤘🏻 |
I tried your way but it did not worked. can you share me you code base? |
but as mentioned doing that keeps all the objects active in the scene (which can be handled manually through messages) |
Thanks for the solution app stop quitting but i am getting some null method exception how to handle that can you explain that |
if you are talking about |
This one fix the problem for me, just to mention :), thanks Mate |
I would love to see this fix merged in... along with many others. I'm drowning in monkey patches over here. 🙈 |
On iOS. I don't know the inner workings of it, so this seems very strange to me. |
• iOS - input not working due to bad initialization order juicycleff#138 (comment) • Android - Bad minimum and target SDK values • Android - Crash when calling quit() on Unity Library juicycleff#46 (comment) • Android - CallStatic to get unity messaging working juicycleff#142
My workaround was similar to that of you guys. Mine(in my forked version of this repo) is as follows:
1.2 In onMethodCall method for case "createUnity", I added the following statement in onReady callback :
as shown below:
It seemed working fine. I was able to exit Unity player by pressing back button and load it back again without my flutter app being crashed or terminated after exiting Unity. |
New 2.0.0 release fixes this issue :) |
The above issue is still shown in the new flutter_unity_widget: ^3.0.3
and in
But this also didn't work and the app still crashes at reopening the screen with UnityWidget in it. |
This issue was closed long ago, yet many people still have the problem and it was not re-opened. I have the same issue with version 4.1.0 of the package, can we have a fix or an update please? My logs
|
same issues |
still not fixed |
My game scene does not render the second time I try to play it. |
Still freezes app if I open unity second time. Even with the provided example. Is there any solution ? |
I believe this issue has been solved |
The unity app still crashes when clicked on back button and try to reopen it. |
still not fixed |
@qiaodongliang Responding to a 3 year old issue that mentions code that probably doesn't even exist anymore won't help anyone solve your issue. |
The unity app run the first time i launch the screen, if I navigate back and reopen the app crashes.
steps: 1- opening unity screen and unity project is running fine.
2- navigate back, this exception is shown:
E/flutter ( 7701): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method dispose on channel unity_view_0) E/flutter ( 7701): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7) E/flutter ( 7701): <asynchronous suspension> E/flutter ( 7701): #1 UnityWidgetController._dispose (package:flutter_unity_widget/flutter_unity_widget.dart:55:19) E/flutter ( 7701): <asynchronous suspension> E/flutter ( 7701): #2 _UnityWidgetState.dispose (package:flutter_unity_widget/flutter_unity_widget.dart:103:19) E/flutter ( 7701): #3 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4107:12) E/flutter ( 7701): #4 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1737:13) E/flutter ( 7701): #5 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #6 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #7 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #8 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #9 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #10 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #11 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #12 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5181:16) E/flutter ( 7701): #13 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #14 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #15 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #16 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #17 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #18 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #19 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #20 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #21 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #22 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #23 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #24 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5080:14) E/flutter ( 7701): #25 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #26 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #27 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #28 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #29 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #30 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5080:14) E/flutter ( 7701): #31 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #32 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #33 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #34 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #35 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #36 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3955:14) E/flutter ( 7701): #37 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1733:13) E/flutter ( 7701): #38 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1735:7) E/flutter ( 7701): #39 ComponentElement.visitChildren
3- reopen the screen again the app crashes with the following error
E/zygote64( 7701): No implementation found for void com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator() (tried Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator and Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator__) E/flutter ( 7701): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.UnsatisfiedLinkError: No implementation found for void com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator() (tried Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator and Java_com_unity3d_player_UnityPlayer_nativeRestartActivityIndicator__) E/flutter ( 7701): at com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator(Native Method) E/flutter ( 7701): at com.unity3d.player.UnityPlayer.resume(Unknown Source:27) E/flutter ( 7701): at com.rexraphael.flutterunitywidget.UnityUtils.addUnityViewToGroup(UnityUtils.java:141) E/flutter ( 7701): at com.rexraphael.flutterunitywidget.UnityView.setUnityPlayer(UnityView.java:21) E/flutter ( 7701): at com.rexraphael.flutterunitywidget.FlutterUnityView.getUnityView(FlutterUnityView.java:101) E/flutter ( 7701): at com.rexraphael.flutterunitywidget.FlutterUnityView.<init>(FlutterUnityView.java:30) E/flutter ( 7701): at com.rexraphael.flutterunitywidget.FlutterUnityViewFactory.create(FlutterUnityViewFactory.java:34) E/flutter ( 7701): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:154) E/flutter ( 7701): at android.app.Dialog.dispatchOnCreate(Dialog.java:403) E/flutter ( 7701): at android.app.Dialog.show(Dialog.java:302) E/flutter ( 7701): at android.app.Presentation.show(Presentation.java:249) E/flutter ( 7701): at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:92) E/flutter ( 7701): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:52) E/flutter ( 7701): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:97) E/flutter ( 7701): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:87) E/flutter ( 7701): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:51) E/flutter ( 7701): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222) E/flutter ( 7701): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96) E/flutter ( 7701): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643) E/flutter ( 7701): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter ( 7701): at android.os.MessageQueue.next(MessageQueue.java:331) E/flutter ( 7701): at android.os.Looper.loop(Looper.java:147) E/flutter ( 7701): at android.app.ActivityThread.main(ActivityThread.java:6699) E/flutter ( 7701): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 7701): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:246) E/flutter ( 7701): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) E/flutter ( 7701): F/flutter ( 7701): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env). Lost connection to device.
how can successfully handle disposing and launching unity?
The text was updated successfully, but these errors were encountered: