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
NetworkOnMainThread Exception #18
Comments
Hi! Can you please give me more details about the stacktrace and tell me the exact steps for reproduce the error? Thanks |
yeah sure,
but this gives me an exception , since I cannot do network ops on the main UI thread (which the |
I understood now, the real problem is in the implementation that this library wrap and the Thread management. |
really sorry for the delay.
Should the |
no problem, can you please push the branch with the implementation on your remote? Moreover, can you please try to downgrade the library to previous versions one by one and see if you have the same problem? I checked the commit and I wouldn't that we have introduced some regressions Thanks |
Hi @sidzi , do you still have the problem? Did you try to downgrade the library one by one? |
@sidzi I'm investigating your error, I have it only on old android versions like 18, not on the latest, that's why I wasn't able to reproduce it. @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
if (mjpegView.isStreaming()) {
mjpegView.stopPlayback();
}
break;
}
return true;
} Can you just confirm please your sdk version with the error? |
Links to similar issue
mostly due to the underling native C code 😰 |
I wasn't able to solve the issue , I am running android 6.0.1 (api 23) also I believe the issue can be solved by putting the code you are debugging outside the main thread but it is resulting in another error , and I am not good with java , (I know how I can solve it , but I need some java advice). |
I have the same issue on my samsung galaxy s6 running android 6.0.1 If I user version 0.3.4 I am not able to resume the playback. void _startPlayback() {
if (mIn != null && thread != null && thread.getState() == Thread.State.NEW) {
mRun = true; //NEVER ENTERS HERE
thread.start();
}
} |
@sidzi and @danieltigse couple of weeks ago I tried to update the UI on this unstable branch but I gave up, I wasted to much time trying to debug and fix this issue. because all the issues are mainly related to the underlying implementation. |
@niqdev I don't know if I have enough knowledge to do this myself , but if you'd like to , I can pair program with you whenever you decide to work on it , if that helps :) |
My only workaround is use the 0.3.4 version, the only version where the stopPlayback method works. And the trick is that when I want to play again I remove and create the view again. |
Thanks @danieltigse for point out the version. |
Hi @danieltigse and @sidzi , I just published version |
Hi @niqdev, now I can use stopPlayback() method. Thanks for your hard working! Anyway I have another problem when I call freeCameraMemory in OnDestroy method, the app crushed! |
@PhanPirang yes, is not supported, here is the implementation @Override
public void freeCameraMemory() {
throw new UnsupportedOperationException("not implemented");
} Actually this method is there only because the initial plan was to wrap also the native library |
Since it seems to work now I will close the issue and update also the app soon. |
@sidzi @danieltigse @PhanPirang If you are working on an open source project, would you be interested to add in the Readme the link to your app? |
No , I wasn't , and thank you for the effort 👍 |
causes the exception and cannot be called in async task or any other worker thread i.e. has to be called from the UI thread :( , How to fix this ?
The text was updated successfully, but these errors were encountered: