AgoraIO-Community / Agora-Flutter-Quickstart

Quickstart guide for the Agora Flutter SDK(Android/iOS)
MIT License
509 stars 192 forks source link

Black Screen when i run your Demo #208

Closed trey-rosius closed 3 years ago

trey-rosius commented 3 years ago

Hi, I get a black screen when i run your demo both on the emulator and as a release on a real device. I also updated the agora SDK plugin to 3.2.1 Flutter Doctor `[✓] Flutter (Channel beta, 1.25.0-8.1.pre, on macOS 11.1 20C69 darwin-x64, locale en-CM) • Flutter version 1.25.0-8.1.pre at /Users/imac/Documents/flutter • Framework revision 8f89f6505b (5 weeks ago), 2020-12-15 15:07:52 -0800 • Engine revision 92ae191c17 • Dart version 2.12.0 (build 2.12.0-133.2.beta)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/imac/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • CocoaPods version 1.10.0

[✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available) • Redmi Note 8 Pro (mobile) • wstoiz5ps4d6r8em • android-arm64 • Android 9 (API 28) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)

Here's the exception i get when i run the app on a real device E/flutter ( 1557): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, width, height, and densityDpi must be greater than 0, null, java.lang.IllegalArgumentException: width, height, and densityDpi must be greater than 0 E/flutter ( 1557): at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:406) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:627) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:618) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:569) E/flutter ( 1557): at io.flutter.plugin.platform.VirtualDisplayController.create(Unknown Source:43) E/flutter ( 1557): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(Unknown Source:110) E/flutter ( 1557): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(Unknown Source:152) E/flutter ( 1557): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(Unknown Source:144) E/flutter ( 1557): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17) E/flutter ( 1557): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(Unknown Source:57) E/flutter ( 1557): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4) E/flutter ( 1557): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter ( 1557): at android.os.MessageQueue.next(MessageQueue.java:326) E/flutter ( 1557): at android.os.Looper.loop(Looper.java:165) E/flutter ( 1557): at android.app.ActivityThread.main(ActivityThread.java:6831) E/flutter ( 1557): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 1557): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) E/flutter ( 1557): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:927) E/flutter ( 1557): ) E/flutter ( 1557): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582) E/flutter ( 1557): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159) E/flutter ( 1557): E/flutter ( 1557): #2 TextureAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1037) E/flutter ( 1557): E/flutter ( 1557): #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:743) E/flutter ( 1557): E/flutter ( 1557): #4 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:195) E/flutter ( 1557): E/flutter ( 1557): E/flutter ( 1557): [ERROR:flutter/flow/layers/transform_layer.cc(24)] TransformLayer is constructed with an invalid matrix. E/flutter ( 1557): [ERROR:flutter/flow/layers/transform_layer.cc(24)] TransformLayer is constructed with an invalid matrix. E/flutter ( 1557): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, width, height, and densityDpi must be greater than 0, null, java.lang.IllegalArgumentException: width, height, and densityDpi must be greater than 0 E/flutter ( 1557): at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:406) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:627) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:618) E/flutter ( 1557): at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:569) E/flutter ( 1557): at io.flutter.plugin.platform.VirtualDisplayController.create(Unknown Source:43) E/flutter ( 1557): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(Unknown Source:110) E/flutter ( 1557): at io.flutter.embedding.engine.systemchan` Screenshot_1611047149

pubspec.yaml agora_rtc_engine: ^3.1.3 permission_handler: ^5.0.1

proguard rules

-keep class io.agora.**{*;}
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

I'll appreciate any help on this. Thanks

LichKing-2234 commented 3 years ago

maybe you can try the stable channel, it seems like a bug from flutter.

LichKing-2234 commented 3 years ago

It works on my device, my flutter doctor

[✓] Flutter (Channel stable, 1.22.4, on macOS 11.1 20C69 darwin-x64, locale
    zh-Hans-CN)
trey-rosius commented 3 years ago

Thanks a ton for the the swift feedback. I'll revert with updates

trey-rosius commented 3 years ago

Same black screen. Here's my flutter doctor

`[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-CM) • Flutter version 1.22.5 at /Users/imac/Documents/flutter • Framework revision 7891006299 (6 weeks ago), 2020-12-10 11:54:40 -0800 • Engine revision ae90085a84 • Dart version 2.10.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/imac/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • CocoaPods version 1.10.0

[!] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] Connected device ! No devices available

! Doctor found issues in 3 categories. `

Here's the github repo incase you wish to run it https://github.com/trey-rosius/agora_flutter_sample

LichKing-2234 commented 3 years ago

here is the difference between your repository with our repository. image

you use Contaner widget to wrap our widget, but you have not set the width and height.

trey-rosius commented 3 years ago

Thanks alot @LichKing-2234 . Changing Container to Expanded solved the issue. Thanks again for the support. I'm going to close this issue now.