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

can't render properly in release apk #5

Closed
leoxupku opened this issue Dec 6, 2021 · 6 comments
Closed

can't render properly in release apk #5

leoxupku opened this issue Dec 6, 2021 · 6 comments

Comments

@leoxupku
Copy link

leoxupku commented Dec 6, 2021

both in running the example flutter project in this repo and my own app based on three_dart, release apk can't get proper display. have you ever try build release apk like "flutter build apk --split-per-abi".

Here are the stack infos:

--------- beginning of crash
--------- beginning of system
--------- beginning of main
12-07 02:03:28.774 21654 21684 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception:  flutter_gl OpenGLContextES.dart toPointer _GrowableList<double> TODO 
12-07 02:03:28.774 21654 21684 E flutter : #0      toPointer (package:flutter_gl/openGL/opengl/OpenGLContextES.dart:928)
12-07 02:03:28.774 21654 21684 E flutter : #1      OpenGLContextES.uniform3fvNormal (package:flutter_gl/openGL/opengl/OpenGLContextES.dart:778)
12-07 02:03:28.774 21654 21684 E flutter : #2      OpenGLContextES.uniform3fv (package:flutter_gl/openGL/opengl/OpenGLContextES.dart:772)
12-07 02:03:28.774 21654 21684 E flutter : #3      WebGLUniformsHelper.setValueV3f (package:three_dart/three3d/renderers/webgl/WebGLUniformsHelper.dart:493)
12-07 02:03:28.774 21654 21684 E flutter : #4      WebGLUniforms.upload (package:three_dart/three3d/renderers/webgl/WebGLUniforms.dart:120)
12-07 02:03:28.774 21654 21684 E flutter : #5      WebGLRenderer.setProgram (package:three_dart/three3d/renderers/WebGLRenderer.dart:1564)
12-07 02:03:28.774 21654 21684 E flutter : #6      WebGLRenderer.renderBufferDirect (package:three_dart/three3d/renderers/WebGLRenderer.dart:568)
12-07 02:03:28.774 21654 21684 E flutter : #7      WebGLRenderer.renderObject (package:three_dart/three3d/renderers/WebGLRenderer.dart:1120)
12-07 02:03:28.774 21654 21684 E flutter : #8      WebGLRenderer.renderObjects (package:three_dart/three3d/renderers/WebGLRenderer.dart:1068)
12-07 02:03:28.774 21654 21684 E flutter : #9      WebGLRenderer.render (package:three_dart/three3d/renderers/WebGLRenderer.dart:819)
12-07 02:03:28.774 21654 21684 E flutter : #10     _ThreeJsScreenState.render (package:try_on_cloth/three_screen.dart:161)
12-07 02:03:28.774 21654 21684 E flutter : #11     _ThreeJsScreenState.animate (package:try_on_cloth/three_screen.dart:152)
12-07 02:03:28.774 21654 21684 E flutter : #12     _ThreeJsScreenState.initPlatformState.<anonymous closure> (package:try_on_cloth/three_screen.dart:92)
12-07 02:03:28.774 21654 21684 E flutter : <asynchronous suspension>
12-07 02:03:28.774 21654 21684 E flutter : 
12-07 02:06:41.657 22048 22078 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception:  flutter_gl OpenGLContextES.dart toPointer _GrowableList<double> TODO 

I found the issule, the type is "_GrowableList", not "List". However when I fixed it, it comes up with another problem. I get white screen. Below is the flutter log for flutter_gl.

12-07 03:32:51.896 508 568 I flutter : device pixel ratio is 3.5
12-07 03:32:51.896 508 568 I flutter : width is 411.42857142857144, height is 898.2857142857143
12-07 03:32:52.025 508 568 I flutter : OpenGLContextES
12-07 03:32:52.025 508 568 I flutter : {gl: Instance of 'LibOpenGLES'}
12-07 03:32:52.026 508 568 I flutter : OpenGLES getExtension key: EXT_color_buffer_float _v: Pointer: address=0xb9a5e400
12-07 03:32:52.027 508 568 I flutter : WebGLState..................init...........
12-07 03:32:52.027 508 568 I flutter : WebGLState. getParameter _data: 0
12-07 03:32:52.100 508 568 I flutter : THREE.WebGLProgram: gl.getProgramInfoLog() programLog: null vertexLog: null fragmentLog: null
12-07 03:35:03.371 811 840 I flutter : device pixel ratio is 3.5
12-07 03:35:03.371 811 840 I flutter : width is 411.42857142857144, height is 898.2857142857143
12-07 03:35:03.499 811 840 I flutter : OpenGLContextES
12-07 03:35:03.499 811 840 I flutter : {gl: Instance of 'LibOpenGLES'}
12-07 03:35:03.499 811 840 I flutter : OpenGLES getExtension key: EXT_color_buffer_float _v: Pointer: address=0xb9fa3800
12-07 03:35:03.501 811 840 I flutter : WebGLState..................init...........
12-07 03:35:03.501 811 840 I flutter : WebGLState. getParameter _data: 0
12-07 03:35:03.558 811 840 I flutter : THREE.WebGLProgram: gl.getProgramInfoLog() programLog: null vertexLog: null fragmentLog: null
12-07 03:37:08.844 1035 1131 I flutter : device pixel ratio is 3.5
12-07 03:37:08.844 1035 1131 I flutter : width is 411.42857142857144, height is 898.2857142857143
12-07 03:37:08.972 1035 1131 I flutter : OpenGLContextES
12-07 03:37:08.972 1035 1131 I flutter : {gl: Instance of 'LibOpenGLES'}
12-07 03:37:08.973 1035 1131 I flutter : OpenGLES getExtension key: EXT_color_buffer_float _v: Pointer: address=0xba0ce800
12-07 03:37:08.974 1035 1131 I flutter : WebGLState..................init...........
12-07 03:37:08.974 1035 1131 I flutter : WebGLState. getParameter _data: 0
12-07 03:37:09.033 1035 1131 I flutter : THREE.WebGLProgram: gl.getProgramInfoLog() programLog: null vertexLog: null fragmentLog: null

it seems the initialization of gles meet some problems and retry for many times.

@wasabia
Copy link
Owner

wasabia commented Dec 7, 2021

  1. maybe dart has some problem on list runtimeType
    List runtimeType on Android release mode flutter/flutter#94781

2.i can not reproduce this error. this is three_dart example project?

@wasabia wasabia closed this as completed in 6b10d05 Dec 7, 2021
@wasabia wasabia reopened this Dec 7, 2021
@leoxupku
Copy link
Author

leoxupku commented Dec 7, 2021

it is too nice of you to answer my problem. I have fixed List runtimeType bug by myself. but I still meet another problem. I upload my project in github. the address is below: https://github.com/leoxupku/try_on_cloth

飞书20211207-224045
at the leftside is the wrong result from the release app, just white screen. at the rightside is the right result from the debug app, just show a rotated cylinder in the background.

@wasabia
Copy link
Owner

wasabia commented Dec 7, 2021

link miss

maybe you can try three_dart example project

@leoxupku
Copy link
Author

leoxupku commented Dec 7, 2021

I try the three_dart project. it works perfectly which means this issue should be closed. the problem must came from some wrong setting or wrong using. I will check it by myself and sync result here. when I build the example project in three_dart, there are two problems I want to share with you. one is the "override dependencies" in pubsepc.yaml shouldn't be uploaded to the remote repository. It all depends on your local working directory. the other is I get trapped into the compiling error caused by "FlutterGlPlugin(width.toInt(), height.toInt())". this function needs two args, but provide with none. this compiling problems may caused by dart version/ flutter version. I think it may be just a warning at your environment.

I checked the example project in flutter_gl, it do reproduce the bug. release apk show nothing but debug apk work properly. I think it may causing by some project wrong settings. can you reproduce the bug in the example project in your flutter_gl repo? @wasabia

@wasabia
Copy link
Owner

wasabia commented Dec 8, 2021

@leoxupku
flutter_gl example work for me on release mode
maybe you need check android studio error log when run release mode

@leoxupku
Copy link
Author

leoxupku commented Dec 8, 2021

I think I found the solution. release app can't display normally because it start too quickly. so MediaQuery.of(context).size return a wrong value (0, 0). I think you may change the display window size to a fixed size or add a timer to trigger the initialization.
flutter/flutter#25827

@leoxupku leoxupku closed this as completed Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants