decodedhealth / flutter_zoom_plugin

Flutter plugin for zoom
Apache License 2.0
125 stars 83 forks source link

Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: flutter_zoom_plugin #39

Open matheusneumanndev opened 4 years ago

matheusneumanndev commented 4 years ago

I cannot run example.

Added: flutter_zoom_plugin: git: url: git://github.com/decodedhealth/flutter_zoom_plugin.git ref: 0.0.7 to pubspec.yaml at example's folder

Added: proguard.cfg to android folder in example's folder

Launching lib/main.dart on Mi A3 in debug mode... ✓ Built build/app/outputs/apk/debug/app-debug.apk. W/IInputConnectionWrapper(21329): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(21329): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(21329): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper(21329): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper(21329): endBatchEdit on inactive InputConnection E/flutter (21329): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: flutter_zoom_plugin E/flutter (21329): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:97) E/flutter (21329): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:95) E/flutter (21329): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59) E/flutter (21329): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226) E/flutter (21329): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/flutter (21329): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) E/flutter (21329): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter (21329): at android.os.MessageQueue.next(MessageQueue.java:336) E/flutter (21329): at android.os.Looper.loop(Looper.java:174) E/flutter (21329): at android.app.ActivityThread.main(ActivityThread.java:7397) E/flutter (21329): at java.lang.reflect.Method.invoke(Native Method) E/flutter (21329): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/flutter (21329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) E/flutter (21329): , null) E/flutter (21329): #0 StandardMethodCodec.decodeEnvelope E/flutter (21329): #1 MethodChannel._invokeMethod E/flutter (21329): E/flutter (21329): #2 MethodChannel.invokeMethod E/flutter (21329): #3 AndroidViewController._create E/flutter (21329): #4 AndroidViewController.setSize E/flutter (21329): #5 RenderAndroidView._sizePlatformView E/flutter (21329): #6 RenderAndroidView.performResize E/flutter (21329): #7 RenderObject.layout E/flutter (21329): #8 RenderProxyBoxMixin.performLayout E/flutter (21329): #9 RenderObject.layout E/flutter (21329): #10 RenderPadding.performLayout E/flutter (21329): #11 RenderObject.layout E/flutter (21329): #12 MultiChildLayoutDelegate.layoutChild E/flutter (21329): #13 _ScaffoldLayout.performLayout E/flutter (21329): #14 MultiChildLayoutDelegate._callPerformLayout E/flutter (21329): #15 RenderCustomMultiChildLayoutBox.performLayout E/flutter (21329): #16 RenderObject.layout E/flutter (21329): #17 RenderProxyBoxMixin.performLayout E/flutter (21329): #18 RenderObject.layout E/flutter (21329): #19 RenderProxyBoxMixin.performLayout E/flutter (21329): #20 _RenderCustomClip.performLayout E/flutter (21329): #21 RenderObject.layout E/flutter (21329): #22 RenderProxyBoxMixin.performLayout E/flutter (21329): #23 RenderObject.layout E/flutter (21329): #24 RenderProxyBoxMixin.performLayout E/flutter (21329): #25 RenderObject.layout E/flutter (21329): #26 RenderProxyBoxMixin.performLayout E/flutter (21329): #27 RenderObject.layout E/flutter (21329): #28 RenderProxyBoxMixin.performLayout E/flutter (21329): #29 RenderObject.layout E/flutter (21329): #30 RenderProxyBoxMixin.performLayout (pa Application finished. Exited (sigterm)

gfiury commented 4 years ago

I have the same problem for Android, I could not fixed it

There is an example here on how to add the proguard.cfg Stackoverflow proguard

You need to change the build.gradle file also not just adding the file into android/app. Android has default names for proguard and you have to set the name the new name of the file.

For example proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'

Is the above correct?

Even though the problem persists, Investigating the exception found this Flutter Issues Proguard

Hope it helps

kevinbayes commented 4 years ago

@tetteu777 can you please provide a sample application that reproduces this error? I can then ave a look into it.

gabrielrbarbosa commented 4 years ago

Same issue here, using this example project. Tried to add proguard file but it gives the same error.

rlechetaudemy commented 4 years ago

Same error here: Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 1.18.0-11.1.pre, on Mac OS X 10.14.6 18G4032, locale en-BR)

gfiury commented 4 years ago

Hello guys

I managed to make it work but on another project.

As the exception says Trying to create a platform view of unregistered type: flutter_zoom_plugin there is a problem registering the flutter_zoom_plugin.

The registering occurs at android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

This is the code of the class at the example

package io.flutter.plugins;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;

/**
 * Generated file. Do not edit.
 * This file is generated by the Flutter tool based on the
 * plugins that support the Android platform.
 */
@Keep
public final class GeneratedPluginRegistrant {
  public static void registerWith(@NonNull FlutterEngine flutterEngine) {
    ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
      com.decodedhealth.flutter_zoom_plugin.FlutterZoomPlugin.registerWith(shimPluginRegistry.registrarFor("com.decodedhealth.flutter_zoom_plugin.FlutterZoomPlugin"));
  }
}

The class is generated by Flutter so, there is no point fixing anything here. But I have another flutter project where the Generated class is

package io.flutter.plugins;

import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.deviceinfo.DeviceInfoPlugin;
import com.decodedhealth.flutter_zoom_plugin.FlutterZoomPlugin;

/**
 * Generated file. Do not edit.
 */
public final class GeneratedPluginRegistrant {
  public static void registerWith(PluginRegistry registry) {
    if (alreadyRegisteredWith(registry)) {
      return;
    }
    DeviceInfoPlugin.registerWith(registry.registrarFor("io.flutter.plugins.deviceinfo.DeviceInfoPlugin"));
FlutterZoomPlugin.registerWith(registry.registrarFor("com.decodedhealth.flutter_zoom_plugin.FlutterZoomPlugin"));
  }

  private static boolean alreadyRegisteredWith(PluginRegistry registry) {
    final String key = GeneratedPluginRegistrant.class.getCanonicalName();
    if (registry.hasPlugin(key)) {
      return true;
    }
    registry.registrarFor(key);
    return false;
  }
}

One of the things that is wierd is the import com.decodedhealth.flutter_zoom_plugin.FlutterZoomPlugin; missing on the example, but it is a generated file so.... it should work.

The exact same meeting_screen.dart on the example and adding

 flutter_zoom_plugin:
      git:
        url: git://github.com/decodedhealth/flutter_zoom_plugin.git
        ref: 0.0.7

on the other project works.

rlechetaudemy commented 4 years ago

I didn't understand how you solve it, since it is a generated file. I tried to change de code, but it got generated again.

gfiury commented 4 years ago

Solved it with a new flutter project, the GeneratedPluginRegistrant is different and the meeting_screen.dart works. I gotta say that the original problem was for Android, the iOS example always worked for me.

rlechetaudemy commented 4 years ago

What version of flutter are you using? I have this version: Flutter (Channel master, 1.18.0-11.1.pre

gfiury commented 4 years ago

I have 1.17.2 (Stable for Windows)

rlechetaudemy commented 4 years ago

Can't get it to work :-( I think the plugin should be update to work like this: https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration

Maadhav commented 3 years ago

Any update on this?

kevinbayes commented 3 years ago

@Maadhav if you have a sample small application that can simulate the problem it would be good to post for us to test.

Maadhav commented 3 years ago

I just downloaded the example and ran the program with my app key and secret. But when I join a meeting the error mentioned above just comes, and nothing appears. Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: flutter_zoom_plugin

longvhv commented 3 years ago

I have the same error: Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: flutter_zoom_plugin

Maadhav commented 3 years ago

@longvhv So to use this plugin u will have yo manually create a new project change the amdroid and ios files as told in the Reame. The same error occurred with me when trying to run the example app

longvhv commented 3 years ago

@longvhv So to use this plugin u will have yo manually create a new project change the amdroid and ios files as told in the Reame. The same error occurred with me when trying to run the example app

Thank @Maadhav , I will give it a try.

Bharavi26 commented 3 years ago

i am getting same error when i run example code... anyone can please help me or there is any demo code in which flutter_zoom_plugin is integrated ?

Maadhav commented 3 years ago

@Bharavi26 I have uploaded my example on my Github. https://github.com/Maadhav/zoom_flutter_example Don't forget to add the necessary keys and secrets in the lib folder. Hope it helps

Bharavi26 commented 3 years ago

Thank you so much @Maadhav sir, I will check that ..I am working on that error from last 2 days,

romeshn commented 3 years ago

I am not able to get it working, below are the steps I followed.

https://github.com/Maadhav/zoom_flutter_example update appKey, appSecret and userId flutter pub run flutter_zoom_plugin:unzip_zoom_sdk dev flutter run Join meeting Then I am getting a blank screen.

An Observatory debugger and profiler on iPhone 11 Pro is available at: http://127.0.0.1:53213/mN3qvL0silY=/ flutter: Created the view [VERBOSE-2:platform_view_layer.cc(20)] Trying to embed a platform view but the PrerollContext does not support embedding [VERBOSE-2:platform_view_layer.cc(37)] Trying to embed a platform view but the PaintContext does not support embedding ... ...

[VERBOSE-2:platform_view_layer.cc(37)] Trying to embed a platform view but the PaintContext does not support embedding [VERBOSE-2:platform_view_layer.cc(20)] Trying to embed a platform view but the PrerollContext does not support embedding [VERBOSE-2:platform_view_layer.cc(37)] Trying to embed a platform view but the PaintContext does not support embedding flutter: initialised flutter: [1, 0]

Maadhav commented 3 years ago

@romeshn Didn't try with ios yet. Could u pls test if the same issue occurs in android?

romeshn commented 3 years ago

@Maadhav similar error in android. see below

D/ (13506): HostConnection::get() New Host Connection established 0xe60b2100, tid 13520 D/ (13506): HostConnection::get() New Host Connection established 0xf0828700, tid 13518 I/flutter (13506): Created the view I/ample.zoom_tes(13506): Background concurrent copying GC freed 20871(2MB) AllocSpace objects, 0(0B) LOS objects, 51% free, 1463KB/2MB, paused 2.091ms total 172.931ms E/BluetoothAdapter(13506): Bluetooth binder is null E/BluetoothAdapter(13506): Bluetooth binder is null I/ZoomSDK (13506): setDomain, set Zoom domain as zoom.us I/Choreographer(13506): Skipped 63 frames! The application may be doing too much work on its main thread. D/EGL_emulation(13506): eglMakeCurrent: 0xec2056c0: ver 3 0 (tinfo 0xd377edf0) I/OpenGLRenderer(13506): Davey! duration=1074ms; Flags=0, IntendedVsync=1735586781847, Vsync=1736636781805, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1736652720993, AnimationStart=1736652784993, PerformTraversalsStart=1736652809993, DrawStart=1736653314993, SyncQueued=1736657195993, SyncStart=1736658399993, IssueDrawCommandsStart=1736658442993, SwapBuffers=1736658693993, FrameCompleted=1736662889993, DequeueBufferDuration=201000, QueueBufferDuration=706000, D/gralloc_ranchu(13506): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) D/ (13506): HostConnection::get() New Host Connection established 0xf0828700, tid 13518 D/gralloc_ranchu(13506): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) D/ (13506): HostConnection::get() New Host Connection established 0xf0828700, tid 13518 D/gralloc_ranchu(13506): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) D/ (13506): HostConnection::get() New Host Connection established 0xf0828700, tid 13518 D/gralloc_ranchu(13506): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread) D/ (13506): HostConnection::get() New Host Connection established 0xf0828700, tid 13518 D/EGL_emulation(13506): eglMakeCurrent: 0xec2056c0: ver 3 0 (tinfo 0xd377edf0) D/EGL_emulation(13506): eglMakeCurrent: 0xec2056c0: ver 3 0 (tinfo 0xd377edf0) I/System.out(13506): Failed to initialize Zoom SDK I/flutter (13506): initialised I/flutter (13506): [2, 3023]

d-at-squareboat commented 3 years ago

Solved it with a new flutter project, the GeneratedPluginRegistrant is different and the meeting_screen.dart works. I gotta say that the original problem was for Android, the iOS example always worked for me.

Android is working fine for me but when it comes to iOS, I'm getting this error. PlatformException(unregistered_view_type, trying to create a view with an unregistered type, unregistered view type: 'flutter_zoom_plugin', null) Can you please let me know how you got it working on iOS?

ahmed20142015 commented 2 years ago

Solved it with a new flutter project, the GeneratedPluginRegistrant is different and the meeting_screen.dart works. I gotta say that the original problem was for Android, the iOS example always worked for me.

Android is working fine for me but when it comes to iOS, I'm getting this error. PlatformException(unregistered_view_type, trying to create a view with an unregistered type, unregistered view type: 'flutter_zoom_plugin', null) Can you please let me know how you got it working on iOS?

Did you find any solutons?