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

dequeueBuffer: BufferQueue has been abandoned #985

Closed
TergelEnkhtur opened this issue Sep 12, 2024 · 3 comments
Closed

dequeueBuffer: BufferQueue has been abandoned #985

TergelEnkhtur opened this issue Sep 12, 2024 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@TergelEnkhtur
Copy link

TergelEnkhtur commented Sep 12, 2024

Describe the bug
E/BufferQueueProducer(21658): ImageReader-904x2190f22m4-21658-0 dequeueBuffer: BufferQueue has been abandoned

When I try to do it myself with no other functionality other than to just start it and display it, I get the following error message which is infinitely repeated and nothing shows up on the phone screen.

To Reproduce
Steps to reproduce the behavior:
I followed all the instructions on the documentation page for Android on the main github (https://github.com/juicycleff/flutter-unity-view-widget/tree/master) as well as the pub.dev (https://pub.dev/packages/flutter_unity_widget) and bunch of Youtube video tutorials and online articles which all did conficting steps, were outdated, and did not work.

Literally just the basic instructions of this library. I followed the Android section to a tee.

Expected behavior
A clear and concise description of what you expected to happen.
For the flutter app to display unity app.

Screenshots
If applicable, add screenshots to help explain your problem.

Unity (please complete the following information):

  • 2022.3.30f1. Currently downloading to try on 2022.2.0f1 as the current fuw-XXXX.unitypackage file, found in the unitypackages folder. "Try to use the most recent unitypackage available." is what the dev wrote, and the current versions in the github folder is fuw-2022.2.0, fuw-2022.1.7f1, fuw-2022.1.1-v2. The versions correspond to Unity Version.

Smartphone (please complete the following information):

  • Device: Samsung Galaxy Z Fold 4
  • OS: API 34
  • Version Android v14

Additional context
Add any other context about the problem here.

Hi all, lovely day for you I hope as I am having a very difficult time with making flutter work with unity. There is a library called flutter_unity_widget by xraph.com on pub.dev which I am trying to make work.

Specs:

  • Android, not using emulators/simulators and just my real/physical phone (Samsung Galaxy Z Fold 4 on Android v14 API 34)

  • Unity 2022.3.30f1. Currently downloading to try on 2022.2.0f1 as the current fuw-XXXX.unitypackage file, found in the unitypackages folder. "Try to use the most recent unitypackage available." is what the dev wrote, and the current versions in the github folder is fuw-2022.2.0, fuw-2022.1.7f1, fuw-2022.1.1-v2. The versions correspond to Unity Version.

  • Flutter

flutter doctor -v
  \[√\] Flutter (Channel stable, 3.19.2, on Microsoft Windows \[Version 10.0.19045.4780\], locale en-CA)
  • Flutter version 3.19.2 on channel stable at C:\\Users\\plazm\\flutter
  • Upstream repository https://github.com/flutter/flutter.git
  • Framework revision 7482962148 (7 months ago), 2024-02-27 16:51:22 -0500
  • Engine revision 04817c99c9
  • Dart version 3.3.0
  • DevTools version 2.31.1

\[√\] Windows Version (Installed version of Windows is version 10 or higher)

\[√\] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\\Users\\plazm\\AppData\\Local\\Android\\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\\Program Files\\Android\\Android Studio\\jbr\\bin\\java
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
• All Android licenses accepted.

\[√\] Chrome - develop for the web
• Chrome at C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe

\[!\] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.6)
• Visual Studio at C:\\Program Files\\Microsoft Visual Studio\\2022\\Community
• Visual Studio Community 2022 version 17.9.34728.123
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for
the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
\- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK

\[√\] Android Studio (version 2023.2)
• Android Studio at C:\\Program Files\\Android\\Android Studio
• 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 17.0.9+0--11185874)

\[√\] VS Code (version 1.93.0)
• VS Code at C:\\Users\\plazm\\AppData\\Local\\Programs\\Microsoft VS Code
• Flutter extension version 3.96.0

\[√\] Connected device (4 available)
• SM F936U (mobile) • RFCW41NBL4H • android-arm64  • Android 14 (API 34)
• Windows (desktop) • windows     • windows-x64    • Microsoft Windows \[Version
10.0.19045.4780\]
• Chrome (web)      • chrome      • web-javascript • Google Chrome 128.0.6613.114
• Edge (web)        • edge        • web-javascript • Microsoft Edge 128.0.2739.42

\[√\] Network resources
• All expected network resources are available.

! Doctor found issues in 1 category.
  • flutter configurations:
static int compileSdkVersion = 34
static int minSdkVersion = 24
static int targetSdkVersion = 33
static String ndkVersion = "23.1.7779620"

This is all in C:\Users\MyPC\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy
  • This is my main.dart
import 'package:flutter/material.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';

void main() {
  runApp(
    const MaterialApp(
      home: UnityDemoScreen(),
    ),
  );
}

class UnityDemoScreen extends StatefulWidget {
  const UnityDemoScreen({Key? key}) : super(key: key);

  @override
  State<UnityDemoScreen> createState() => _UnityDemoScreenState();
}

class _UnityDemoScreenState extends State<UnityDemoScreen> {
  static final GlobalKey<ScaffoldState> _scaffoldKey =
  GlobalKey<ScaffoldState>();
  UnityWidgetController? _unityWidgetController;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      body: SafeArea(
        bottom: false,
        child: WillPopScope(
          onWillPop: () async {
            // Pop the category page if Android back button is pressed.
            return true;
          },
          child: Container(
            color: Colors.yellow,
            child: UnityWidget(
              onUnityCreated: onUnityCreated,
            ),
          ),
        ),
      ),
    );
  }

  // Callback that connects the created controller to the unity controller
  void onUnityCreated(controller) {
    _unityWidgetController = controller;
  }
}

  • pubspec.yaml
name: flutter_unity
description: "A new Flutter project."
publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: '>=3.3.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.6
  flutter_unity_widget: ^2022.2.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^3.0.0

flutter:
  uses-material-design: true
  • IDE
Android Studio Iguana | 2023.2.1 Patch 1
Build #AI-232.10300.40.2321.11567975, built on March 13, 2024
Runtime version: 17.0.9+0--11185874 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
    ide.experimental.ui=true
    ide.images.show.chessboard=true

Non-Bundled Plugins:
    Dart (232.10313)
    io.flutter (79.0.1)

Full output trimmed as it was too long

...
E/BufferQueueProducer(21658): [ImageReader-904x2190f22m4-21658-0](id:549a00000002,api:1,p:1619,c:21658) dequeueBuffer: BufferQueue has been abandoned
I/ViewRootImpl@a411167[MainActivity](21658): onDisplayChanged oldDisplayState=2 newDisplayState=2
E/BufferQueueProducer(21658): [ImageReader-904x2190f22m4-21658-0](id:549a00000002,api:1,p:1619,c:21658) dequeueBuffer: BufferQueue has been abandoned
E/BufferQueueProducer(21658): [ImageReader-904x2190f22m4-21658-0](id:549a00000002,api:1,p:1619,c:21658) dequeueBuffer: BufferQueue has been abandoned

Under known issues, it says Unity freezes and crashes on Android, please use OpenGL3 as Graphics API.
I have tried doing this, no difference.

I manually stop the program up there as the "BufferQueue has been abandoned" message gets repeated infinitely and on the screen is just the page full of yellow.

Any help is welcome! @juicycleff

@timbotimbo timbotimbo added the duplicate This issue or pull request already exists label Sep 12, 2024
@timbotimbo
Copy link
Collaborator

timbotimbo commented Sep 12, 2024

You are running into this issue caused by a bug in Flutter 3.19.
This should be fixed in Flutter 3.22.

If you have to use Flutter 3.19, your only option is to use the useAndroidViewSurface: true parameter. This changes the Flutter embedding mode to an alternative that isn't affected by this specific bug.

If you upgrade to Flutter 3.24, you have to use the workaround in this issue as that version requires a small fix in the plugin that isn't on pub.dev yet.

For the Unity version, use 2022.3.x .

@TergelEnkhtur
Copy link
Author

Thank you for you quick reply! I will be sure to try this and report back.

@TergelEnkhtur
Copy link
Author

It is working so far, so I will close this, thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants