无法以编程方式通过Jenkins启动appium。这在从Eclipse运行时有效。
Jenkins在控制台上发出以下错误。这并没有给出任何细节错误报告。 我正在使用appium版本1.7.1 CLI npm。出现以下错误:
java.lang.OutOfMemoryError
当我从CLI手动启动appium并在评论自动appium start后从Jenkins运行BUILD时,脚本工作正常。
我是否会错过任何配置设置?我配置了以下项目:
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;
ProgressBar progressBar;
public DownloadImageTask(ImageView bmImage, ProgressBar progressBar) {
this.bmImage = bmImage;
this.progressBar = progressBar;
}
protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in); //Line A
int resultWidth = mIcon11.getWidth();
int resultHeight = mIcon11.getHeight();
while(resultWidth > 256 && resultHeight > 256) {
resultWidth *= 0.5;
resultHeight *= 0.5;
}
mIcon11 = Bitmap.createScaledBitmap(mIcon11, (int) (resultWidth), (int) (resultHeight), true);
} catch (OutOfMemoryError e){
byte[] byteArr = new byte[0];
byte[] buffer = new byte[1024];
int len;
int count = 0;
InputStream in = null;
try {
in = new java.net.URL(urldisplay).openStream();
while ((len = in.read(buffer)) > -1) {
if (len != 0) {
if (count + len > byteArr.length) {
byte[] newbuf = new byte[(count + len) * 2]; //Line B
System.arraycopy(byteArr, 0, newbuf, 0, count);
byteArr = newbuf;
}
System.arraycopy(buffer, 0, byteArr, count, len);
count += len;
}
}
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteArr, 0, count, options);
options.inSampleSize = calculateInSampleSize(options, 256, 256);
options.inPurgeable = true;
options.inInputShareable = true;
options.inJustDecodeBounds = false;
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
mIcon11 = BitmapFactory.decodeByteArray(byteArr, 0, count, options);
} catch (IOException e1) {
e1.printStackTrace();
}
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon11;
}
protected void onPostExecute(Bitmap result) {
bmImage.setImageBitmap(result);
progressBar.setVisibility(View.GONE);
progressBar.setIndeterminate(false);
bmImage.setVisibility(View.VISIBLE);
}
public int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
// Calculate ratios of height and width to requested height and width
final int heightRatio = Math.round((float) height / (float) reqHeight);
final int widthRatio = Math.round((float) width / (float) reqWidth);
// Choose the smallest ratio as inSampleSize value, this will guarantee
// a final image with both dimensions larger than or equal to the
// requested height and width.
inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
}
return inSampleSize;
}
}
答案 0 :(得分:0)
在父标记的testng.xml中保持verbose = 10,这样可以为您提供测试失败的更多详细信息