I am working on a simple project to automate an android applications' nightly build. I have prepared all the configurations(like bash script, gradle, android-sdk etc.) to start the build. The thing is, the application builds successfully and work fine on the phone when i build it on my local computer. But when i build it on my company's build server, it gives the runtime error below, even though it build successfully;
01-08 05:46:46.688 14675 14721 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
01-08 05:46:46.688 14675 14721 E AndroidRuntime: Process: com.vestel.camera, PID: 14675
01-08 05:46:46.688 14675 14721 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:309)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.Void[]
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at com.android.camera.CameraActivity$UpdateThumbnailTask.doInBackground(CameraActivity.java:826)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:295)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-08 05:46:46.688 14675 14721 E AndroidRuntime: ... 3 more
What might be the reason for such an error? I am using the exact copies of sdk and gradle in both machines, but when i build it on the server it gives this error. By the way, i also tried the same process on a third computer, and it also worked just fine.
This is the doInBackground method of UpdateThumbnailTask class;
private class UpdateThumbnailTask extends AsyncTask<Void, Void, Bitmap> {
private final byte[] mJpegData;
private final boolean mCheckOrientation;
public UpdateThumbnailTask(final byte[] jpegData, boolean checkOrientation) {
mJpegData = jpegData;
mCheckOrientation = checkOrientation;
}
@Override
protected Bitmap doInBackground(Void... params) {
if (mJpegData != null)
return decodeImageCenter(null);
LocalDataAdapter adapter = getDataAdapter();
ImageData img = adapter.getImageData(1);
if (img == null) {
return null;
}
Uri uri = img.getContentUri();
String path = getPathFromUri(uri);
if (path == null) {
return null;
}
else {
if (img.isPhoto()) {
return decodeImageCenter(path);
} else {
return ThumbnailUtils
.createVideoThumbnail(path, MediaStore.Video.Thumbnails.MINI_KIND);
}
}
}
.
.
.
the object of UpdateThumbnailTask is created a few times;
if(ImageStorage.getInstance().getImageList().size() == 0) {
Log.w(TAG,"onActivityResult imagelist 0");
Utils.execute(new UpdateThumbnailTask(null, true));
}
.
public void updateThumbnail(final byte[] jpegData) {
Utils.execute(new UpdateThumbnailTask(jpegData, false));
}
.
public void updateThumbnail(boolean videoOnly) {
// Only handle OnDataInserted if it's video.
// Photo and Panorama have their own way of updating thumbnail.
if (!videoOnly || (mCurrentModule instanceof VideoModule)) {
Utils.execute(new UpdateThumbnailTask(null, true));
}
}
Thanks in advance.