-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
java.lang.NullPointerException: getSurface(...) must not be null #1603
Comments
Hello, Are you doing the startStream after the preview is inflated like in the example? (Using the onSurfaceChanged callback) Can you share the code where you are doing startStream? |
No matter if you are in a float window. You need wait until that callback is called or the surface will be null or invalid. |
I can confirm that my startStream event is executed after surfaceChanged:Surface(name=null)/@0xf77b5a8 has been executed and has a value. |
I'm not sure about it but that surface is not ready for some reason. Maybe the surface is created, destroyed and re created. surfaceView.holder.surface.isValid Also, remember that if your preview was detroyed and you need use a different preview you need change the preview: //go to background, no preview available
genericFromFile.replaceView(context)
//the preview object changed, replace preview with the new view
genericFromFile.replaceView(openglView) I can help you more if you are able to share a full code example. |
I will need a full code example to reproduce the error. Can you share me a minimal code example? |
It's not that I don't want to post it, it's that my apk is hooked through xposed. This OpenGlView uses the acitivity environment intercepted by the host app, and then a floating window pops up on it. It has been working fine before, but suddenly the host app has been updated. I used your library to push the stream. All the codes are normal, but this problem occurred when I started pushing the stream. So I want to ask you whether it is related to the opengl environment of the app used. |
I did a fix for it: implementation 'com.github.pedroSG94.RootEncoder:library:fix~opengl-start-SNAPSHOT' |
I used this version but it still doesn't work. The following two pictures are new errors. Later, I no longer used the previous host activity. I changed an activity to display the OpenGlView on the floating window. Finally, it will not crash. I don't know why some phones crash on which activity. But I really appreciate your answer. |
Hello, Thank you for the report. It is interesting, the library is not able to get shaders resources. implementation 'com.github.pedroSG94.RootEncoder:library:f0b9aa3fcb' |
Do you still have resources not found error like before? |
I used it for nearly a year without any problems. Recently, the host app of the xposed hook seemed to have been hot-updated, which started to cause this problem on some models. After I changed the activity, it became normal. So I suggest you ignore this problem, because it is indeed a problem that only occurs with unconventional apps. |
Hello, I will ignore this issue until someone find a way to share a code example to reproduce the error. |
When I use GenericFromFile and push local files, I get
java.lang.NullPointerException: getSurface(...) must not be null
I can confirm that I have implemented the method according to the steps in the document,
surfaceView = OpenGlView(context!!)
bindingFloatWindow?.frameSurfaceView?.addView(surfaceView)
genericFromFile = GenericFromFile(openGlView, this, this, this)
It sometimes works, but sometimes it doesn't, and the above error will appear
The text was updated successfully, but these errors were encountered: