I think the error was here:
plugin/wikitude_plugin/android/src/main/java/com/wikitude/wikitude_plugin/ArchitectWidget.java:139
architectView = new ArchitectView(context);
Throw this: wikitude java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
Hi Cristobal,
As we're handling this request via our support ticket, let's stick to the ticket for now to make the communication as efficient as possible.
Thx and greetings
Nicola
Hola hemos comprobado que el plugin de Wikiyude version 9 para Flutter podría ser incompatible con Flutter 1.12, si se crea un proyecto desde cero aparece el emnsaje de error "MALFORMATED JSON", lo mismo ocurre en una aplicación Flutter anterior a esta versión (ej: 1.09) al hacer un migrate a 1.2 (https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects). Sí funciona si se ha creado un proyecto en Flutter 1.09, después hemos actualizado Flutter a 1.12 pero no así el proyecto, que seguiría teniendo Flutter 1.09. De esta manera funcionaría pero no tendríamos las nuevas funcionalidades ni los parches de seguridad de las nuevas versiones. También destacar que no podríamos contar con los demás plugins actualizados
I have this same problem. Is there a solution?
We continue having this problem...
Hi,
Here is further feedback from our team:
We have just tested the last version of Flutter (flutter v1.12.13+hotfix9) within our project from github and it was working fine -> the camera was being shown and tracking. Nevertheless, we had to handle the error mentioned (context == null) recently and fixed it, so it will be included in the next release (coming in the next weeks). We'll will make sure that the sample from github is also updated.
Thx and greetings
Nicola
Thank you Cristobal,
There is no more error, but I have another problem, well, 2 problems, I hope you can help me:
The first one: In iOS the camera works fine, but in Android the camera is not working, the app have all the permissions. In the logcat I got this errors:
2020-05-16 09:10:02.162 25963-25963/com.xxio.xxio I/Camera: open camera: 1, package name: com.xxio.xxio
2020-05-16 09:10:02.163 25963-25963/com.xxio.xxio D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in.
2020-05-16 09:10:02.163 25963-25963/com.xxio.xxio I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory.
2020-05-16 09:10:02.166 25963-25963/com.xxio.xxio I/HwCameraUtil: notifySurfaceFlingerCameraStatus : isFront = true , isOpend = true
2020-05-16 09:10:02.167 25963-25963/com.xxio.xxio I/HwCameraUtil: notifySurfaceFlingerFrontCameraStatus 8011 transact success!
2020-05-16 09:10:02.230 25963-25963/com.xxio.xxio E/WKTD: >Error: [com.wikitude.camera.android][00:00:12.269.070] > Focus mode CONTINUOUS is not supported by the device. (code 1006)
2020-05-16 09:10:02.230 25963-25963/com.xxio.xxio E/WKTD: >Error: [com.wikitude.camera.android][00:00:12.269.252] > Can not set unsupported focus mode CONTINUOUS. (code 1006) (underlying error: Focus mode CONTINUOUS is not supported by the device. (code 1006))
2020-05-16 09:10:02.231 25963-25963/com.xxio.xxio E/WKTD: >Error: [com.wikitude.camera.android][00:00:12.270.226] > Manual focus is only supported with camera2. (code 1006)
2020-05-16 09:10:02.462 25963-26006/com.xxio.xxio W/libEGL: EGLNativeWindowType 0x700d668e90 disconnect failed
2020-05-16 09:10:02.502 25963-26153/com.xxio.xxio W/HiTouch_HiTouchSensor: depended package hiTouch does n't exist!
2020-05-16 09:10:02.502 25963-26153/com.xxio.xxio I/HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist.
Probably you had this kind of error,
The second one: im relatively new in flutter development, and the wikitude documentation about using flutter doesn't say (or I don't understand) how use architectWidget.callJavascript(), and architectWidget.setJSONObjectReceivedCallback(), as far I understand those methods are codecs to comunicate with SDK, but I litte bit lost in this topic. My aproach is load dinamically wtc files. For me the problem is that the examples provided by wikitude only loads html files and the logic is in the .js files.
Hi Lelyla, the issue can be this: CameraFocusMode.CONTINUOUS in
archit
architectWidget = ArchitectWidget( onArchitectWidgetCreated: onArchitectWidgetCreated, licenseKey: wikitudeTrialLicenseKey, startupConfiguration: StartupConfiguration( cameraPosition: CameraPosition.BACK, cameraFocusMode: CameraFocusMode.CONTINUOUS, cameraResolution: CameraResolution.SD_640x480), features: ["image_tracking"], );
test OFF or ONCE.... If not work attach your device to test if available.
In the other hand
- architectWidget.callJavascript() is in order to send data to webview (js) of WikitudeWorld
Yo have to call it in onLoadSuccess in your dart code:
this.architectWidget.load(loadPath, onLoadSuccess, onLoadFailed);
like this example, you pass a JSON data and in the main js of WikitudeWorld you get it:
this.architectWidget.callJavascript("World.getDataFromFlutter('$_jsonData')");
And in your javascript class dev a method called "getDataFromFlutter" and take it and parse it (JSON.parse).
- architectWidget.setJSONObjectReceivedCallback() is in order to get data from webview (js) of WikitudeWorld, you receive a dart json
You receive a dart json from
this.architectWidget.setJSONObjectReceivedCallback((data) { final YourReturnModel _dataFromWikitude = YourReturnModel .fromJson(data); .... }
And you method to send this data in js WikitudeWorl is:
onRecognition: function onRecognitionFn ( recognized, response ) { if ( recognized ) { AR.platform.sendJSONObject( { action: 'StringToIdentifierAction', data : response }); } }
Then automatically you get the data in your dart code
I hope this help you...
Info
When I try to execute the wikitude (updated) plugin example in flutter updated (https://github.com/Wikitude/wikitude-flutter-plugin-examples) I get some errors in console, a black screen appear in the app, con you help me:
I/WebViewFactory( 2075): Loading com.android.chrome version 81.0.4044.117 (code 404411723)
I/cr_LibraryLoader( 2075): Loaded native library version number "81.0.4044.117"
W/.com.flutterap( 2075): Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (light greylist, reflection)
E/JSON ( 2075): Malformed JSON
E/MethodChannel#flutter/platform_views( 2075): Failed to handle method call
E/MethodChannel#flutter/platform_views( 2075): java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
E/MethodChannel#flutter/platform_views( 2075): at android.view.ViewGroup.addView(ViewGroup.java:4796)
E/MethodChannel#flutter/platform_views( 2075): at android.view.ViewGroup.addView(ViewGroup.java:4778)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:178)
E/MethodChannel#flutter/platform_views( 2075): at android.app.Dialog.dispatchOnCreate(Dialog.java:407)
E/MethodChannel#flutter/platform_views( 2075): at android.app.Dialog.show(Dialog.java:302)
E/MethodChannel#flutter/platform_views( 2075): at android.app.Presentation.show(Presentation.java:249)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:93)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:53)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:105)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#flutter/platform_views( 2075): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#flutter/platform_views( 2075): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/platform_views( 2075): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#flutter/platform_views( 2075): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#flutter/platform_views( 2075): at android.app.ActivityThread.main(ActivityThread.java:6762)
E/MethodChannel#flutter/platform_views( 2075): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views( 2075): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#flutter/platform_views( 2075): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter ( 2075): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Cannot add a null child view to a ViewGroup, null)
E/flutter ( 2075): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter ( 2075): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter ( 2075): <asynchronous suspension>
E/flutter ( 2075): #2 AndroidViewController._create (package:flutter/src/services/platform_views.dart:640:54)
E/flutter ( 2075): #3 AndroidViewController.setSize (package:flutter/src/services/platform_views.dart:557:14)
E/flutter ( 2075): #4 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:174:29)
E/flutter ( 2075): #5 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:155:5)
E/flutter ( 2075): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1703:9)
E/flutter ( 2075): #7 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #8 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #9 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #10 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #11 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:163:11)
E/flutter ( 2075): #12 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:477:7)
E/flutter ( 2075): #13 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:232:7)
E/flutter ( 2075): #14 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:391:14)
E/flutter ( 2075): #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #16 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #17 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #18 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #19 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11)
E/flutter ( 2075): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #21 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #25 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #30 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #31 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #32 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #33 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 2075): #34 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #35 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3166:14)
E/flutter ( 2075): #36 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 2075): #37 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:505:15)
E/flutter ( 2075): #38 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1584:7)
E/flutter ( 2075): #39 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)
E/flutter ( 2075): #40 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:344:19)
E/flutter ( 2075): #41 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:774:13)
E/flutter ( 2075): #42 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
E/flutter ( 2075): #43
My flutter doctor:
Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Versión 10.0.18363.778], locale es-ES)
• Flutter version 1.12.13+hotfix.9 at D:\programas\flutter
• Framework revision f139b11009 (3 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\android-sdk
• ANDROID_SDK_ROOT = C:\android-sdk
• Java binary at: D:\programas\android_studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at D:\programas\android_studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] Connected device (1 available)
• Mi A1 • 3fa168d70504 • android-arm64 • Android 9 (API 28)
• No issues found!
1 person has this problem