Start a new topic

Flutter SDK - Load customUrl as a Sample in wikitude-flutter-plugin-examples

 Hello.

We are taking a closer look at the https://github.com/Wikitude/wikitude-flutter-plugin-examples

And we were wondering if there is some documentation we can look into regarding

this.targetCollectionResource = new AR.TargetCollectionResource("assets/test.wtc", {

});

And documentation about customUrlLauncher.

So we can load a custom URL from "Wikitude Studio Hosting" function, instead of test.wtc in our own "samples".

Question 2, how do we load test.wtc so it works like in the customUrlLauncher?

If we use the sample 01_ImageTracking_1_ImageOnTarget as a template, we can load test.wtc but we get the overaly image. We don't wont the overlay image from the sample, but we want the overlay image defined in "Studio Editor" instead (https://www.wikitude.com/external/doc/documentation/latest/flutter/imagerecognition.html#image-recognition).

Thank you.


1 person has this problem

Hi,


You can have more information about the targetCollectionResource in our documentation page: https://www.wikitude.com/external/doc/documentation/latest/flutter/imagerecognition.html#image-recognition and our API reference page: https://www.wikitude.com/external/doc/documentation/latest/Reference/JavaScript%20API/index.html.


As per the customUrlLauncher, it is a sample as any other of the ones that are in the assets folder, with the only difference that it is not located in the assets folder but in a custom Url. The way to load it is the same as the rest of the samples by calling the this.architectWidget.load(loadPath, onLoadSuccess, onLoadFailed); method with you own url as loadPath.


What do you mean by overlay image? If it is the augmentation that is shown once the image is tracked, what you will need to do is to add it into the Wikitude Studio Hosting project as explained here: https://www.wikitude.com/external/doc/documentation/studio/studioeditor.html.


Regards,


Aitor.

Okay nice.


So a javascript file (.js) in the samples folder with the following code work?

For example replacing imageontarget.js

var World = {
    this.architectWidget.load('https://exampleurl.com', onLoadSuccess, onLoadFailed); 
};
World.init();

 The overlay image is not important when we have the archiitectWidget.load.


The main difference is that the samples are written in javascript and the CustomUrl launcher is in dart.


Thank you.


Hi,


Please have another look at our sample app: https://github.com/Wikitude/wikitude-flutter-plugin-examples where we show a proper way to use the wikitude flutter plugin. Summarizing: this.architectWidget.load(...) is also called from dart in the arview.dart file. Indeed, in that file is where we have all the required communication between the app and our SDK.


Regards,


Aitor.

Hi, yes, the sample app launches the custom URL from the menu, and we will probably figure out how to run it from the samples.json list.


I tried to follow the flutter documentation: https://www.wikitude.com/external/doc/documentation/latest/flutter/setupguideflutter.html#setup-guide-flutter


But already at step: "Using the Wikitude package" it fails compilation, because the import of the packages fails.

import 'package:augmented_reality_plugin_wikitude/architect_widget.dart';
import 'package:augmented_reality_plugin_wikitude/startupConfiguration.dart';


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':augmented_reality_plugin_wikitude:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :augmented_reality_plugin_wikitude project caused this error: /home/gnowak/AndroidStudioProjects/greg-wikitude/my_app/plugin/augmented_reality_plugin_wikitude/android/wikitudesdk/wikitudesdk.aar 

By fiddling a bit around I remembered that the your Flutter plugin needs Gradle version 5.6.4. Nothing about this in the documentation?


When downgrading Gradle to version 5.6.4 I get the following error:


Minimum supported Gradle version is 6.5. Current version is 5.6.4.


So I am going back to the fiddle around with the Flutter Examples project instead. Because following the Wikitude SDK Flutter documentation is hard. Also it's written for Flutter 1.x, but the Flutter examples is for Flutter 2.x (Note The guide is based on Flutter version 1.22.3 (using Dart 2.8.3)).

The guide should at least give us customers an easy option to setup the project with the right dependencies?


Is it possible to get a guide to set up a flutter project with the current dependencies for flutter 2.x and a main.dart with an example of loading two differen custom URLs from the Wikitude Hosting functionality? A guide that is not outdated?


Thank you.

Hi,


We are currently working on a fix for the latest flutter version, where we are still internally creating the SDK with the Android Gradle Plugin 3.6.0 version and the Gradle package pointing to the 5.6.4 version. An upgrade will come within the next release -> we will be using the Android Gradle Plugin 4.2.0 version and the Gradle package will point to the 6.7.1 version.


What I would suggest for now is to downgrade it as you are already doing, until the new version is released.


Regarding the documentation, it is true that it is a bit outdated, so I'm creating an internal ticket to tackle this as soon as possible.


Thank you,


Aitor.

Hi, OK, but a downgrade of Gradle in a a clean flutter install is not done in an easy way because of other dependencies. 


Sounds good with the next version.


I am not able to downgrade a clean flutter, I will try to work around the "Flutter Examples Flutter SDK code", because I am able to run it, and it looks like it compiles to Android and IOS.


Thank you for the internal ticket.


We are currently looking into workarounds, because the  Wikitude App is being discontinued the 15th of August and it might take 14 days to get the app published in Apple App Store, so our deadline is 1. of August ish.


Thank you.

Login or Signup to post a comment