I have an app that works fine in android 2.3.4, 2.3.6 and 2.3.7 but it doesn´t in android 4.1.2 or 4.2.2 (I have no more devices)
The app calls to a jar file that returns a result, when I test the app in 2.3.7 I make the call to the jar and takes the result but when I do it with android 4.1.2 it forces the close. It´s quite weird because the only difference is the OS because the app is the same.
The jar file makes a call to internet, I don´t think this could be the mistake
Thanks again everybody!
The jar file makes a call to internet, I don´t think this could be the mistake
=> Sorry dude problem is here, as you said your app is working fine in < 2.3 versions but not in >2.3, reasons behind this failure is NetworkOnMainThreadException
.
Now, Why this exception is being raised whenever you run app in >2.3 version device?
=> NetworkOnMainThreadException
occurs whenever an application attempts to perform a networking operation on its main thread.
Below are the two solutions to resolve this issue:
1) Standard way is to make webservice call by implementing AsyncTask.
2) The lazy way of handling this is to turn the check of:
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);