我正在尝试使用 AWS Java SDK 1.10.16 将 apk 上传到 AWS Device Farm
首先,我创建 Upload 对象以获取使用 PUT 请求发送 apk 所需的上传 url:
Upload upload = client.createUpload(new CreateUploadRequest().withProjectArn(project.getArn()).withContentType("application/octet-stream").withName(fileName).withType(UploadType.ANDROID_APP)).getUpload();
System.out.println(upload.toString());
String urlUpload = upload.getUrl();
然后我执行 PUT 发送我的 apk 文件:
executor.execute(Request.Put(urlUpload).bodyFile(file, ContentType.APPLICATION_OCTET_STREAM).addHeader("Content-Type", "application/octet-stream", )).returnContent().asString();
但上传失败:
{Arn: arn:aws:devicefarm:us-west-2:<account_id>:upload:<resource>,Name: arquivo2917332797798158569.tmp,Created: Fri Sep 11 11:16:33 BRT 2015,Type: ANDROID_APP,Status: FAILED,Metadata: {"errorMessage":"Invalid application uploaded."},ContentType: application/octet-stream,}
带有“上传的应用程序无效”错误消息。
我究竟做错了什么?
谢谢。