简体   繁体   English

带有不同消息的 Flutter 调试垃圾邮件控制台

[英]Flutter debugging spams console with different messages

I'm getting a lot of weird messages when debugging my flutter app on my OnePlus 6. The messages appear when I click on buttons, swipe and so on.在我的 OnePlus 6 上调试我的 flutter 应用程序时,我收到了很多奇怪的消息。当我单击按钮、滑动等时会出现这些消息。 I'm on Android Pie.我在 Android Pie 上。

Some of the messages:一些消息:

E/libc    (10995): Access denied finding property 
"vendor.debug.egl.swapinterval"
W/1.gpu   (10995): type=1400 audit(0.0:2806794): avc: denied { read } for 
name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=21671 
scontext=u:r:untrusted_app_27:s0:c512,c768 
tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
E/libc    (10995): Access denied finding property 
"vendor.debug.egl.swapinterval"
E/libc    (10995): Access denied finding property 
"vendor.debug.egl.swapinterval"
E/libc    (10995): Access denied finding property 
"vendor.debug.egl.swapinterval"
E/libc    (10995): Access denied finding property 
"vendor.debug.egl.swapinterval"
W/1.gpu   (10995): type=1400 audit(0.0:2806805): avc: denied { read } for 

How do I get rid of them, the app seems to work fine.我如何摆脱它们,该应用程序似乎运行良好。 It's hard to read print() messages with all this clutter.很难阅读杂乱无章的 print() 消息。

The workaround is to use Flutter's software renderer, which silences these errors at the cost of reduced graphics performance as compared to Flutter's default hardware-accelerated OpenGL renderer:解决方法是使用 Flutter 的软件渲染器,与 Flutter 的默认硬件加速 OpenGL 渲染器相比,它以降低图形性能为代价来消除这些错误:

$ flutter run --enable-software-rendering

To be clear, though, this isn't a Flutter bug.不过,需要明确的是,这不是 Flutter 错误。 It's an issue with the system libraries ( libEGL , libgralloc ?) on Android Pie on OnePlus 6 (and perhaps the Google Pixel 3), and ultimately needs a fix by the device vendor and/or Google.这是 OnePlus 6(可能还有 Google Pixel 3)上的 Android Pie 上的系统库( libEGLlibgralloc ?)的问题,最终需要设备供应商和/或 Google 进行修复。 There are some indications that installing the latest system updates might have fixed this issue for some users, at least, as of late October 2018.迹象表明,至少在 2018 年 10 月下旬,安装最新的系统更新可能已为某些用户解决了此问题。

Based on a commit that purports to fix the same issue on Google's new Pixel 3 XL device (codename "crosshatch"), the underlying problem appears to be that either Android Pie itself or vendor customizations to Android introduced a new dependency on the vendor.debug.egl.swapinterval build property, but this property access was denied by security policy.基于一项旨在解决 Google 新 Pixel 3 XL 设备(代号“crosshatch”)上相同问题的提交,潜在问题似乎是 Android Pie 本身或供应商对 Android 的定制引入了对供应商的新依赖vendor.debug.egl.swapinterval构建属性,但此属性访问被安全策略拒绝。 The fix is to change the security policy to permit the boot animation and apps access to this property.修复方法是更改​​安全策略以允许启动动画和应用程序访问此属性。

And what is vendor.debug.egl.swapinterval ?什么是vendor.debug.egl.swapinterval It controls the display frame rate.它控制显示帧速率。 Quoting the Khronos Group documentation for the eglSwapInterval API, this interval:引用eglSwapInterval API 的 Khronos Group 文档,这个间隔:

Specifies the minimum number of video frames that are displayed before a buffer swap will occur.指定在发生缓冲区交换之前显示的最小视频帧数。

As a cursory search on the XDA Forums shows, modders have been tweaking this parameter for years.正如在 XDA 论坛上的粗略搜索所显示的,模组制作者多年来一直在调整这个参数。

If this happens to you now (March 2019) with OnePlus device (possibly even other devices) after the Flutter 1.2.1 upgrade, you can either use the "--enable-software-rendering" workaround as stated in accepted answer by Arto Bendiken or this one:如果您现在(2019 年 3 月)在 Flutter 1.2.1 升级后使用 OnePlus 设备(甚至可能是其他设备)发生这种情况,您可以使用“--enable-software-rendering”解决方法,如 Arto Bendiken 接受的答案中所述或者这个:

Look into your build.gradle file located in your project folder ($PROJECT_FOLDER/android/app/) and look at compileSdkVersion and targetSdkVersion .查看位于项目文件夹 ($PROJECT_FOLDER/android/app/) 中的build.gradle文件,并查看compileSdkVersiontargetSdkVersion If those numbers are set to 28 , lower them to 27 (or lower, if you want / need to).如果这些数字设置为28 ,请将它们降低到27 (或更低,如果您愿意/需要)。 Flutter 1.2.1 generates projects with those variables set to 28 (Android 9 Pie). Flutter 1.2.1 生成的项目将这些变量设置为 28(Android 9 Pie)。

Explanation:解释:
Some users stated that upgrading to newer versions of the ROM fixed the issue for them.一些用户表示,升级到较新版本的 ROM 为他们解决了这个问题。 I use this device:我使用这个设备:

Device: OnePlus 6T (ONEPLUS A6013)设备:一加6T(一加A6013)
Build: A6013_41_190123型号:A6013_41_190123
OxygenOS: 9.0.12氧气操作系统:9.0.12

Someone wrote that it was fixed for him in version 9.0.3, which is older than my 9.0.12.有人写过,9.0.3 版本已经为他修复了,比我的 9.0.12 还旧。

The thing is that I used this device with Flutter 1.0.0 without any problem and after Flutter 1.2.1 upgrade (and new project generation) this started to happen.问题是我在 Flutter 1.0.0 上使用这个设备没有任何问题,在 Flutter 1.2.1 升级(和新项目生成)之后,这开始发生。 Older projects still worked without this issue, so I checked some files for differences and found out that build.gradle differs.旧项目仍然没有这个问题,所以我检查了一些文件的差异,发现 build.gradle 不同。 In other words Flutter 1.2.1 is targetting Android 9 Pie by default.换句话说,Flutter 1.2.1 默认针对 Android 9 Pie。 It is still probably related to OnePlus tho, because I tried running the app on some Moto G phone with Android 8 and the issue was not present there.它仍然可能与 OnePlus tho 相关,因为我尝试在一些装有 Android 8 的 Moto G 手机上运行该应用程序,但该问题不存在。 (Even with compile/targetSdkVersion set to 28). (即使 compile/targetSdkVersion 设置为 28)。

Still getting the same error with Flutter+ Firebase( google SignIn) on Oneplus 6. 在Oneplus 6上使用Flutter + Firebase(google SignIn)仍然遇到相同的错误。

Need to a solution 需要解决方案

Works on Oneplus 3 and Oneplus 7. 适用于Oneplus 3和Oneplus 7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM