I currently cannot recreate this error on my physical device (S6). Things work fine for me and the changes I have made do not seem to be solving this issue. I have the following error:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ExceptionInInitializerError
at a.a.b.m.a(Unknown Source)
at a.a.b.p.<clinit>(Unknown Source)
at a.a.b.g.<init>(Unknown Source)
at a.a.b.f.<init>(Unknown Source)
at a.a.c.di.b(Unknown Source)
at a.a.c.di.a(Unknown Source)
at a.a.c.b.a(Unknown Source)
at a.a.c.ae.a(Unknown Source)
at a.a.a.a.a(Unknown Source)
at a.a.a.f.e(Unknown Source)
at a.a.a.b.a(Unknown Source)
at com.airborne.grgr4.f.a(Unknown Source)
at com.airborne.grgr4.f.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
Caused by: java.lang.NullPointerException: in == null
at java.util.Properties.load(Properties.java:246)
at a.a.b.m.d(Unknown Source)
at a.a.b.m.<clinit>(Unknown Source)
I know this is quite a common error when trying to update the UI from a background thread or some other threading misuse. What is messing me up is that I cannot recreate this error on my Galaxy S6 so I cannot properly fix it. Here is my async code:
new selectRepsBasedOnZipCode().execute(zipCode);
^^Calling method.
private class selectRepsBasedOnZipCode extends AsyncTask<String, Void, ArrayList<String>> {
protected ArrayList<String> doInBackground(String... params) {
ArrayList<String> UserRepsBasedOnZip = new ArrayList<String>();
String firstPartOfURL = "https://www.opencongress.org/search/result?q=";
String lastPartOfURL = "&search_people=1";
String urlToParse = firstPartOfURL + params[0] + lastPartOfURL;
try {
Document doc = Jsoup.connect(urlToParse).get();
Elements content = doc.getElementsByClass("name");
for (Element name : content) {
UserRepsBasedOnZip.add(name.childNode(0).toString().trim());
}
} catch (Exception ex) {
return UserRepsBasedOnZip;
}
return UserRepsBasedOnZip;
}
@Override
protected void onPostExecute(ArrayList<String> UserRepsBasedOnZip) {
finishBuildingLocalRepPage(UserRepsBasedOnZip);
}
}
I am using JSoup to do some of this work. As I said I cannot recreate the issue (Program is compiled from Android Studio on my device as the latest version) but others I know that have the app report this crash.
This is the only Async method I have in this stage of events, so this leads me to believe that this must be the place the crash is happening. Any feedback or suggestions on a fix and how to verify the fix would be great, thanks.
+Bonus if you can explain why this works flawlessly on my device (S6) but fails on all other devices (L-01F, Galaxy Tab A 8.0, Galaxy S4, HTC One).