0

I'm trying to upload an apk to AWS Device Farm using the AWS Java SDK 1.10.16

First, I create the Upload object to get the upload url needed to send the apk using a PUT request:

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();  

Then I execute the PUT sending my apk file:

executor.execute(Request.Put(urlUpload).bodyFile(file, ContentType.APPLICATION_OCTET_STREAM).addHeader("Content-Type", "application/octet-stream", )).returnContent().asString();

But the upload fails:

{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,}

with the "Invalid application uploaded" error message.

What am I doing wrong?

Thanks.

user2816801
  • 205
  • 1
  • 2
  • 7

2 Answers2

1

From the response, it looks like your file has a .tmp extension. For Android uploads, Device Farm expects a .apk file.

billy
  • 126
  • 1
1

I had the same error. Had to switch to dir where the .apk file is located and then upload only with the filename.extension and that worked.