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.12k stars 514 forks source link

exported the arkit unity demo example #123

Open mariuschiriac opened 4 years ago

mariuschiriac commented 4 years ago

I've created a new flutter project and followed the readme guide to implement flutter_unity_widget.

What I've done different from the guide to make it works: 1) Add the following to your /android/settings.gradlefile:

include ':app', ':unity-classes'
include ":UnityExport"
project(":UnityExport").projectDir = file("./UnityExport")

2)the process to create unity-classes folder of the video doesn't works for me, that's what i did: from android studio, File -> New -> New Module... -> import .JAR/.AAR Package -> Next -> in "File name:" choose the .jar under UnityExport/libs then, move the created ""unity-classes" folder to /android/ from android studio that automatically adjust the reference and other stuff. 3)replace the minSdkVersion from 16 to 19

ok, now the project can be runned (flutter run) without errors, but still the result is the flutter base project.

Using the main.dart of the example in the release 0.1.6-1 I get this error:

D/eglCodecCommon(13128): setVertexArrayObject: set vao to 0 (0) 1 0
E/Unity   (13128): Failed to load 'libmain.so', the application will terminate.
E/flutter (13128): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.unity_test-nNkFIUkFEiRWHU-p0wa8_w==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.unity_test-nNkFIUkFEiRWHU-p0wa8_w==/lib/x86, /data/app/com.example.unity_test-nNkFIUkFEiRWHU-p0wa8_w==/base.apk!/lib/x86, /system/lib]]] couldn't find "libmain.so"
E/flutter (13128):  at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
[...]
F/flutter (13128): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env). 
F/libc    (13128): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 13128 (mple.unity_test), pid 13128 (mple.unity_test)

Using the lib folder of the master of this repo I get this screen and it crashes when i click.

image

and that's all... I've tried to make it works and i'm feeling so close to the goal, I've also tried some other variant of the dart but without solving. here is the link to what i've done https://github.com/mariuschiriac/demo_flutter_unity Please help me.

juicycleff commented 4 years ago

@mariuschiriac Arkit demo is not updated for the latest versions of unity. You will have to set things up properly if your using latest unity versions

mariuschiriac commented 4 years ago

@juicycleff but im not using ar kit in my project actually... by the way what should i set up at least? i'm actually working on thi master repo and release package too, and same error on both and no AR using there... i just want to make it start normally to start to test something

EhsanBrd commented 4 years ago

Same here , any suggestion bro ?

@juicycleff but im not using ar kit in my project actually... by the way what should i set up at least? i'm actually working on thi master repo and release package too, and same error on both and no AR using there... i just want to make it start normally to start to test something

sadly same here :( did you find any solution ?

praghadeeshsivakumar commented 4 years ago

I am experiencing the same problem. Any Solution?

NorseGaud commented 4 years ago

I believe @juicycleff means that we exported the project with the latest version of Unity and Arkit (maybe he didn't mean Arkit and instead Unity) in this repo doesn't support it. Rex can you confirm?

NorseGaud commented 4 years ago

I'm using 2019.3.5 btw (which the README says it supports)...

RobertDodonyMinero commented 4 years ago

I got this to work on Android, haven't tried it on iOS. It worked on both Unity 2019.3.5 and Unity 2019.4.4. I tried different AR Foundation, ARCore XR Plugin versions, but newer versions all produced errors. Stick to the default version after importing the project. (AR Foundation 2.1.8, ARCore XR Plugin 2.1.8, ARKit XR Plugin 2.1.9).

I did the exact same steps as @mariuschiriac and encountered the same issue. The error message seemed weird at first, but somewhere it said x86. I went back to Unity and saw that under File > Build Settings > Player Settings > Player (tab) > Other Settings you can find Target Architectures. I noticed that in the VIDEO there is an option for x86. From Unity 2019.3 x86 has been removed from Android target architectures. I checked both boxes for ARMv7 and ARM64, and of course I didn't have x86. To export the project make sure to use Flutter > Export Android (Unity 2019.3.*)*. (It worked using Unity 2019.4.4 too, but export it as Export Android (Unity 2019.3.). The main problem is in Android Studio emulation**. Most people use x86 emulation (I am new to Android development, so correct me if I am wrong), and this Unity build doesn't support it. Using the emulator I had the same problem. I built it to a tablet and it worked just fine. The same "Please make sure you exported the ARKIT unity demo example" text appeared and after clicking on it Unity launched with the sampleScene. You could do an ARM64 based image for emulation, but from my testing it was painfully slow.

fdelucchijr commented 4 years ago

The main problem is in Android Studio emulation. Most people use x86 emulation (I am new to Android development, so correct me if I am wrong), and this Unity build doesn't support it. Using the emulator I had the same problem. I built it to a tablet and it worked just fine. The same "Please make sure you exported the ARKIT unity demo example" text appeared and after clicking on it Unity launched with the sampleScene. You could do an ARM64 based image for emulation, but from my testing it was painfully slow.

For this I use BlueStacks and run Android in ARM version. Build the APK and install it. It isn't the fastest way to test the app, but it works very well.

khal-it commented 4 years ago

any solutions for ios ???

akhileshv25 commented 4 weeks ago
Screenshot 2024-08-09 at 8 29 23 AM

after build successfully I am facing this issue is any solution for iOS