Closed alexanderameye closed 3 years ago
@juicycleff would it be possible to review the readme for v4 to make sure the steps are correct for ar foundation? I'm having a hard time getting it to work and don't really understand the additional steps that need to be taken, specifically about the .so files and creating the 'modules', any help or additional info would be greatly appreciated. Anyways a huge thanks for working on this plugin, I'm hoping to contribute as well.
@alexanderameye very true, I will update the readme, though I did. Will have one ready tonight. Maybe time to write a simple docs. Readme is getting too large
I managed to get the AR examples working on version 3.0.0 with Unity 2019.4.13f.
FlutterUnityPackage-3.0.0.unitypackage
, the one listed at the top of the readme is an older version. the correct one is mentioned in the AR section of the readme.build.cs
Flutter -> Export android
, this should create the files in the android/unityLibrary
folder. (if it creates unityExport
, you are using an old version of the build scripts)lib/arm64**
folder you will find the libarpresto_api.so
and libUnityARCore.so
files for arcore.
I used the arm64 files, i'm not sure which to choose if you want to deploy to both arm7 and arm64.android/unityLibrary/libs
Update the android/unityLibrary/build.gradle
file to include the .so files
You will get something like this
dependencies {
implementation(name: 'unity-classes', ext:'jar')
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'UnityAds', ext:'aar')
implementation(name: 'UnityAdsAndroidPlugin', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation(name: 'UnityARCore', ext:'aar')
//these 2 are new
implementation(name: 'libarpresto_api', ext:'so')
implementation(name: 'libUnityARCore', ext:'so')
}
- I think I also changed the compileSdkVersion in `android/app/build.gradle` to make it match with my unity player settings
At this point debugging the flutter application runs the AR scene on my android phone.
I never had to touch gradle, I only have what came along with android studio.
Because we started with the example project
`android/settings.gradle` already contained
include ":unityLibrary" project(":unityLibrary").projectDir = file("./unityLibrary")
and `android/build.grade` contained
allprojects { repositories { flatDir { dirs "${project(':unityLibrary').projectDir}/libs" }
My main issues were that the AR example project was using flutter_unity_view_widget 0.1.6 and and old version of the unitypackage, which made the readme confusing as I never got a `unityLibrary` folder.
@timbotimbo thank you for this, that's reassuring! I'm going to try this out as soon as I can, thanks :)
I had been facing the exact same problems and finally got rid of the "missing package key" by upgrading Gradle in Android Studio. I posted my solution here. Hope that helps :)
I had been facing the exact same problems and finally got rid of the "missing package key" by upgrading Gradle in Android Studio. I posted my solution here. Hope that helps :)
Thank you so much, I haven't had the time yet to look into this but once we're at that stage of the project I'll try out your suggestions. Thank you for sharing, I really appreciate it.
@timbotimbo @russelljahn @gisinator @juicycleff
Thank you for all of the input. All of your info together ultimately did the trick for me and got my AR foundation project (not a sample project) to work using Unity 2020.1, AR Foundation 3 and version 3 of flutter_unity_widget.
I am writing this guide (started as just a guide for myself) detailing all the steps I'm taking together with all the errors I encountered (a lot!) and how to fix them. I added some of the info mentioned by you all in there as well. The guide is public here and you can edit it as well.
https://www.notion.so/UAAL-3a4d77089d09420b9ceb00fdd4d37a99
@juicycleff I don't know what your plans are in terms of replacing the readme but I'd love to contribute and I hope this guide can be a good start! It's nowhere to being complete (lacking iOS steps completely since I don't own a macbook to build on) but there are a lot of potential errors + fixes in there and detailed steps together with screenshots.
@alexanderameye thanks for this. I really do appreciate it. I am very much strained myself and any contributions is welcomed. I plan on moving the docs from the readme to a website and I think that would be the right place as I hope to keep the docs clean. As for unity 2021 it's still on my todo to run the plug-in against and test if it works out of the box, but most cases, the major issues are gradle dependency differences which again might have to do with your apps peculiar unity native Android or iOS dependencies
@alexanderameye I will setup a docs repo and invite you. I hope to make v4 docs and steps as stable and mature as possible, but one thing is I can't guarantee automatic setup, since each unity app can contain native dependencies that needs manual setup.
@alexanderameye here is the docs repo, feel free to add your updates https://github.com/juicycleff/flutter-unity-widget-docs
@alexanderameye thank you very much for your documentation, it really saved my week! As an addition (I had the NDK not installed issue) I had to do this https://github.com/juicycleff/flutter-unity-view-widget/issues/322#issuecomment-939508997 . I added the ndk.dir in my android/local.properties. Afterwards the Flutter build finally worked!
So I've been trying to get this to work with an AR Foundation project on Unity 2020.1
First, there was a unity build error, which I was able to fix by doing this
https://github.com/juicycleff/flutter-unity-view-widget/issues/234#issuecomment-735307249
After that, I got this error in flutter build:
Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54
Same issue as here: https://github.com/juicycleff/flutter-unity-view-widget/issues/279#issue-770271806
After looking online, I tried upgrading gradle version but no luck.
Is the readme/wiki updated? I'm very confused by all the steps I have to or don't have to take. Does this work with AR Foundation on Unity 2020.1?
Would love to see this package more updated/more mature but I can understand if the dev is busy!
If anybody has got this working with AR Foundation on Unity version 2019.3 or Unity version 2020.X, I would love to know how you did it!