how run a unity project in flutter
1,129
After the result you saw, I believe answering your question would help a lot of people who will just start off with this.
The solution is to use your real device and run the project using flutter run
.
Why success in real device and failure in emulator?
Many a times, an emulator doesn't supports some functionalities. The real device has a perfect engine to support all of them, hence you get the problem sorted.
To Build apk
flutter build apk --release
Consider reading upon this documentation: Build and release an Android app
Author by
behnam
Updated on December 20, 2022Comments
-
behnam over 1 year
I try to add my simple unity project to flutter but after build-in console I got an Error:
Lost connection to the device.
top of consol in vsCode I get these Error with red colour:
Note: C:\Fproject\unity_flutter\android\UnityExport\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_unity_widget-0.1.6+8\android\src\main\java\com\rexraphael\flutterunitywidget\FlutterUnityViewFactory.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
what should I do?? please help
Thanks a lot.
-
Alok over 3 yearsYou are getting
Lost connection to deivce
. Can you doflutter doctor -v
and show me the result here? -
behnam over 3 years@Alok these are the Result: I send them Separately
-
behnam over 3 yearsPS C:\Fproject\unity_flutter> flutter doctor -v [√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.836], locale en-US) • Flutter version 1.17.5 at C:\src\flutter • Framework revision 8af6b2f038 (5 weeks ago), 2020-06-30 12:53:55 -0700 • Engine revision ee76268252 • Dart version 2.8.4
-
behnam over 3 years[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\patris10\AppData\Local\Android\sdk • Platform android-29, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted.
-
behnam over 3 years[√] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin version 48.0.1 • Dart plugin version 192.8052 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
-
behnam over 3 years[√] VS Code (version 1.47.3) • VS Code at C:\Users\patris10\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.13.1 [√] Connected device (1 available) • Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 10 (API 29) (emulator) • No issues found!
-
Alok over 3 yearsHmm... Okay, as far the as the result is concerned. It looks fine. Behnam could you run the project on your real android device please? The command is
flutter run
only, make sure your real device has Debug option enabled -
behnam over 3 years@Alok thanks so much for your help😍😍 when I build it in real device it run sucsessfuly..👌 so what is the problem with android emulator my friend?? and I cant build apk too..when I use flutter build apk
-
Alok over 3 yearsAdded building data to my answer behnam
-
Cu'i Bap over 3 yearsHi @behnam, Could you please show me how to add unity project to Flutter. Many Thanks.
-