Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The example does not work on Android #39

Closed
Marcus-Ospicon opened this issue Apr 12, 2020 · 1 comment
Closed

The example does not work on Android #39

Marcus-Ospicon opened this issue Apr 12, 2020 · 1 comment

Comments

@Marcus-Ospicon
Copy link

Marcus-Ospicon commented Apr 12, 2020

Hi, I try to use your sample on my emulator device but it doesn't work for me, please help me. I created a list view with a title and open the camera page when tapping on it
My camera_view.dart code is

import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';

class MenuCameraView extends StatefulWidget {
  @override
  _MenuCameraViewState createState() => _MenuCameraViewState();
}

class _MenuCameraViewState extends State<MenuCameraView> {
  final String urlToStreamVideo = 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4';
  static final VlcPlayerController controller = VlcPlayerController(
      // Start playing as soon as the video is loaded.
      onInit: () {
    controller.play();
  });
  final double playerWidth = 360;
  final double playerHeight = 240;

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          height: playerHeight,
          width: playerWidth,
          child: VlcPlayer(
            aspectRatio: 16 / 9,
            url: urlToStreamVideo,
            controller: controller,
            placeholder: Center(child: CircularProgressIndicator()),
          ),
        ),
      ),
    );
  }
}

My pubspec.yaml

name: relife_mobile_app
description: An app mobile for smarthome.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.2.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_webview_plugin: ^0.3.10+1
  http: ^0.12.0+4
  mqtt_client: ^6.0.0
  flutter_launcher_icons: ^0.7.4
  provider: ^4.0.4
  shared_preferences: ^0.5.6+3
  sqflite: ^1.3.0
  device_id: ^0.2.0
  auto_size_text: ^2.1.0
  flutter_vlc_player: ^2.0.0

flutter_icons:
  image_path: "assets/logos/app_logo.png" 
  android: true
  ios: true


dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/roundwave_logo.png
    - assets/images/devices/rts_1x33_white.non-shadow.gif
    - assets/images/devices/rmo_110_white.non-shadow.gif
    - assets/images/VN-Flag-icon.png
    - assets/images/USA-Flag-icon.jpg
    - assets/i18n/en.json
    - assets/i18n/vi.json

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: Microsoft Sans Serif
      fonts:
        - asset: assets/fonts/Microsoft_Sans_Serif.ttf
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

My AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.relife_mobile_app">
    <!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Relife"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

My error is

I/flutter ( 6841): Go to Camera page
E/flutter ( 6841): [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_video_plugin/getVideoView
E/flutter ( 6841): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:91)
E/flutter ( 6841): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96)
E/flutter ( 6841): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
E/flutter ( 6841): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/flutter ( 6841): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/flutter ( 6841): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/flutter ( 6841): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 6841): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter ( 6841): at android.os.Looper.loop(Looper.java:160)
E/flutter ( 6841): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/flutter ( 6841): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 6841): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/flutter ( 6841): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter ( 6841): , null)
�[38;5;244mE/flutter ( 6841): #0 StandardMethodCodec.decodeEnvelope�[39;49m
�[38;5;244mE/flutter ( 6841): #1 MethodChannel.invokeMethod�[39;49m
E/flutter ( 6841):
�[38;5;244mE/flutter ( 6841): #2 AndroidViewController._create�[39;49m
�[38;5;244mE/flutter ( 6841): #3 AndroidViewController.setSize�[39;49m
�[38;5;244mE/flutter ( 6841): #4 RenderAndroidView._sizePlatformView�[39;49m
�[38;5;244mE/flutter ( 6841): #5 RenderAndroidView.performResize�[39;49m
�[38;5;244mE/flutter ( 6841): #6 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #7 RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #8 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #9 RenderOffstage.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #10 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #11 RenderStack.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #12 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #13 RenderAspectRatio.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #14 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #15 RenderConstrainedBox.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #16 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #17 RenderPositionedBox.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #18 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #19 MultiChildLayoutDelegate.layoutChild�[39;49m
�[38;5;244mE/flutter ( 6841): #20 _ScaffoldLayout.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #21 MultiChildLayoutDelegate._callPerformLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #22 RenderCustomMultiChildLayoutBox.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #23 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #24 RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #25 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #26 RenderProxyBoxMixin.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #27 _RenderCustomClip.performLayout�[39;49m
�[38;5;244mE/flutter ( 6841): #28 RenderObject.layout�[39;49m
�[38;5;244mE/flutter ( 6841): #29 RenderProxyBoxMixin.performLayout�[39;49m
E/flutter ( 6841): #30 RenderObject.layout (package:flutt

The

flutter doctor -v

[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.17763.1098], locale en-US)
    • Flutter version 1.12.13+hotfix.9 at C:\src\flutter
    • Framework revision f139b11009 (13 days 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.3)
    • Android SDK at C:\Users\MarcusPC\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\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 C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code, 32-bit edition (version 1.43.2)
    • VS Code at C:\Program Files (x86)\Microsoft VS Code
    • Flutter extension version 3.9.1

[√] Connected device (1 available)
    • AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

! Doctor found issues in 1 category.

Thanks!

@Marcus-Ospicon
Copy link
Author

It was fixed with using

flutter upgrade
Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant