user2816801
user2816801

Reputation: 205

"Invalid application uploaded" when trying to put file to AWS Device Farm using Java SDK

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.

Upvotes: 0

Views: 339

Answers (2)

Lavanya Bathina
Lavanya Bathina

Reputation: 21

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.

Upvotes: 2

billy
billy

Reputation: 126

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

Upvotes: 1

Related Questions