-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#50792Labels
a: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appse: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systeme: device-specificOnly manifests on certain devicesOnly manifests on certain devicesplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-views: vdIssues specific to the Android VirtualDisplay platform views backendIssues specific to the Android VirtualDisplay platform views backendr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform team
Description
Steps to reproduce
I've created a new project with flutter create and integrated a simple test view on Android side as per https://docs.flutter.dev/platform-integration/android/platform-views.
The issue seems to be happening exclusively on Pixel devices running the latest Android 14 QPR2 Beta 3/3.1, as well as QPR 3 Beta 1, with confirmed device/build number:
- Pixel 6 running AP11.231215.009 (QPR2 Beta 3.1)
- Pixel 7 running AP11.231215.009 (QPR2 Beta 3.1)
- Pixel 7 running AP11.231215.007 (QPR2 Beta 3)
- Pixel 6 running AP21.240119.009 (QPR3 Beta 1)
Steps to reproduce:
- Launch the app
- Switch to Home Screen
- Open an app or two(camera, phone app etc.)
- Go back to the sample app
Sample project:
platform_view_test.zip
Expected results
The platform view hosted by Flutter app is displayed.
Actual results
The platform view is not displayed, instead the place it used to occupy is rendered solid black.
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
final Map<String, dynamic> creationParams = <String, dynamic>{};
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text("App"),
),
body: AndroidView(
viewType: "nativeView",
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
),
);
}
}Platform side:
package com.example.platform_view_test
import android.annotation.SuppressLint
import android.content.Context
import android.view.View
import android.widget.TextView
import io.flutter.plugin.common.StandardMessageCodec
import io.flutter.plugin.platform.PlatformView
import io.flutter.plugin.platform.PlatformViewFactory
class NativeView(context: Context, id: Int, creationParams: Map<String?, Any?>?) : PlatformView {
private val textView: TextView
init {
textView = TextView(context)
textView.text = "Hello, world!"
textView.textSize = 42.0F
}
override fun getView(): View {
return textView
}
override fun dispose() { }
}
class NativeViewFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
val creationParams = args as Map<String?, Any?>?
return NativeView(context, viewId, creationParams)
}
}Screenshots or Video
Video demonstration
Screen_recording_20240206_121942.mp4
Logs
Logs
Launching lib/main.dart on Pixel 6 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:57985/bhXmu9Cq3aA=/ws
D/CompatibilityChangeReporter(15445): Compat change id reported: 210923482; UID 10436; state: ENABLED
D/CompatibilityChangeReporter(15445): Compat change id reported: 63938206; UID 10436; state: DISABLED
I/PlatformViewsController(15445): Hosting view in view hierarchy for platform view: 0
D/VRI[MainActivity](15445): Draw frame after cancel
D/VRI[MainActivity](15445): visibilityChanged oldVisibility=true newVisibility=false
2
D/VRI[MainActivity](15445): applyTransactionOnDraw applyImmediately
D/VRI[MainActivity](15445): Not drawing due to not visible
4
D/VRI[MainActivity](15445): applyTransactionOnDraw applyImmediately
D/VRI[MainActivity](15445): Start draw after previous draw not visible
Application finished.
Exited.Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.16.8, on macOS 14.3 23D56 darwin-arm64, locale en-FI)
• Flutter version 3.16.8 on channel stable at /Users/romanlaitarenko/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 67457e669f (3 weeks ago), 2024-01-16 16:22:29 -0800
• Engine revision 6e2ea58a5c
• Dart version 3.2.5
• DevTools version 2.28.5
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
• Android SDK at /Users/romanlaitarenko/Library/Android/sdk
• Platform android-34, build-tools 33.0.0-rc2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.15.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.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 17.0.7+0-17.0.7b1000.6-10550314)
[✓] VS Code (version 1.85.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.82.0
[✓] Connected device (5 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator)
• Roman’s iPhone (2) (mobile) • 00008110-00110D1614F9801E • ios • iOS 17.3 21D50
• iPhone 15 Pro (mobile) • 0FE6C8F5-669A-48F4-9CDD-CAB2E34556D1 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.3 23D56 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.234
[✓] Network resources
• All expected network resources are available.
• No issues found!persidskiy and pjleonard37
Metadata
Metadata
Assignees
Labels
a: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appse: OS-version specificAffects only some versions of the relevant operating systemAffects only some versions of the relevant operating systeme: device-specificOnly manifests on certain devicesOnly manifests on certain devicesplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-views: vdIssues specific to the Android VirtualDisplay platform views backendIssues specific to the Android VirtualDisplay platform views backendr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform team