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

Support Impeller on Android #867

Open
Tracked by #968
JgomesAT opened this issue Nov 17, 2023 · 18 comments · May be fixed by #1283
Open
Tracked by #968

Support Impeller on Android #867

JgomesAT opened this issue Nov 17, 2023 · 18 comments · May be fixed by #1283
Assignees
Labels
android Platform android bug Something isn't working P0

Comments

@JgomesAT
Copy link

JgomesAT commented Nov 17, 2023

This message has been updated to outline the most up-to-date information on this bug. The original comment is kept at the bottom

With the release of Flutter 3.27, Impeller on Android has released to stable. This issue tracks adding support for Impeller in mobile_scanner.

We should do the following:

  1. Follow the steps from https://docs.flutter.dev/release/breaking-changes/android-surface-plugins including the rotation correction for camera previews
  2. Bump the minimum required Flutter version to 3.27, per the note in https://docs.flutter.dev/release/breaking-changes/android-surface-plugins#timeline due to the fact that during the 3.24 - 3.27 timeframe a bug was discovered in the Impeller API for Android, which has been fixed in 3.27
  3. Add a TODO to switch from onSurfaceDestroyed to onSurfaceCleanup in the stable release after Flutter 3.28
  4. Notify users that adding io.flutter.embedding.android.EnableImpeller is no longer required for mobile_scanner usage

The message below is the un-edited original post for this issue

With the recent improvement of Impeller on Flutter 3.16 I tried to compile my app with <meta-data android:name="flutterEmbedding" android:value="2" /> <meta-data android:name="io.flutter.embedding.android.EnableImpeller" android:value="true" />

with this, the camera is black and does not work, in iOS with impeller works fine

@frankmer
Copy link

Same problem for me.

@navaronbracke
Copy link
Collaborator

Impeller for Android is still in preview. On Android API 29+ this uses Vulkan, which still has some issues with platform views.

@teolemon teolemon added the android Platform android label Nov 24, 2023
@JgomesAT
Copy link
Author

is there any change with the new Flutter 3.19 and IMpeller, this library is not working with this option

@navaronbracke
Copy link
Collaborator

As I started above, Impeller on Android is still in preview. Work on external textures has progressed however.
A patch for this is about to land on flutter/engine. If you absolutely need Impeller on Android right now, your best bet is to switch to the master channel. But that is at your own risk, since the master channel is not for production apps.

@mfiumara
Copy link

mfiumara commented Apr 5, 2024

As I started above, Impeller on Android is still in preview. Work on external textures has progressed however. A patch for this is about to land on flutter/engine. If you absolutely need Impeller on Android right now, your best bet is to switch to the master channel. But that is at your own risk, since the master channel is not for production apps.

I have the same problem. I have updated my local flutter version to the latest main channel but the problem persists:

Flutter is already up to date on channel main
Flutter 3.22.0-5.0.pre.34 • channel main • https://github.com/flutter/flutter.git
Framework • revision 45deb49716 (2 hours ago) • 2024-04-05 03:42:30 -0700
Engine • revision 292c48b9af
Tools • Dart 3.5.0 (build 3.5.0-18.0.dev) • DevTools 2.34.1

You mention that this has been fixed on the current master channel, can you confirm on what version you have tested this?

My mobile_scanner version is on 5.0.0-beta.2.

@bobekos
Copy link

bobekos commented May 16, 2024

Hi any news to this? Tested on:
Flutter 3.22 with mobile_scanner 5.1.1 still not working.

@espresso3389
Copy link
Contributor

Even official camera/video plugins do not run with Android Impeller (flutter/flutter#139702).

@JgomesAT
Copy link
Author

JgomesAT commented May 16, 2024

I have the same problem, the camera stay in black, I not work in flutter 3.22 with Impeller in stable in Android

@navaronbracke
Copy link
Collaborator

navaronbracke commented May 24, 2024

We will have to migrate from createSurfaceTexture to createSurfaceProducer. This is a new API for Impeller with Vulkan, but will require Flutter 3.22.

@navaronbracke navaronbracke self-assigned this May 24, 2024
@navaronbracke navaronbracke added the bug Something isn't working label May 24, 2024
@navaronbracke
Copy link
Collaborator

Small update: there is an upstream regression with the SurfaceProducer and Vulkan (OpenGL is unaffected). Will hold off on implementing this until the upstream bug is fixed.

@rohansohonee1
Copy link

FYI: Flutter 3.24 has been released.

Do you have any updates to share?

@navaronbracke
Copy link
Collaborator

I am aware that Flutter 3.24 has landed, and there is an update to the existing Impeller migration doc at flutter/website#11008

I went through that doc before to see what was needed to migrate and I noticed that something was missing (notably the preview orientation, which was the subject of an ongoing discussion on the hackers chat on Discord, which I had followed)

However, I don't think we need to wait for this website doc to land, as what is needed is there for us.
The SurfaceProducer API is available since Flutter 3.22.

I'll update the required steps in the original post in this thread, to reflect the needed steps.

@navaronbracke
Copy link
Collaborator

I am currently working through several smaller bugs that I want to include in the next release. After that I'll work on the Impeller migration, since I don't want to force our users to switch to 3.24 for the other bugfixes.

@markuznw
Copy link

Following this, impeller gives a slight performance boost, thanks

@espresso3389
Copy link
Contributor

espresso3389 commented Dec 12, 2024

Flutter 3.27.0 stable is released with Android Impeller enabled by default. According to the official release note, we need <meta-data android:name="io.flutter.embedding.android.EnableImpeller" android:value="false" /> on AndroidManifest.xml until mobile_scanner finally supports it.

@JgomesAT
Copy link
Author

and the schedule to do that?

@navaronbracke
Copy link
Collaborator

@espresso3389 Thanks for notifying me. I will mark this as P0 in our priority queue and will put this next on the list for the next beta for version 7.0.0

@navaronbracke navaronbracke pinned this issue Dec 12, 2024
@navaronbracke navaronbracke changed the title Camera won't work when impeller enabled on Android Support Impeller on Android Dec 12, 2024
@navaronbracke
Copy link
Collaborator

FYI: Work on the Impeller migration has started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Platform android bug Something isn't working P0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants