appium / appium/java-client

Unable to push a zip file to my Android device

Open
#1,840 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

I am trying to push a zip file of 900 MB size to my Android device.
Command:
driver.pushFile("/sdcard/Android/data/com.example.demoapp/files/file.zip", new File("C:\\Users\\rajdeep.dodiya\\resources\\apk\\file.zip"))

I am getting the below error:

uncaughtException: Invalid string length
RangeError: Invalid string length
    at IncomingMessage.onData (C:\Users\rajdeep.dodiya\AppData\Roaming\npm\node_modules\appium\node_modules\raw-body\index.js:259:25)
    at IncomingMessage.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at IncomingMessage.Readable.push (node:internal/streams/readable:228:10)
    at HTTPParser.parserOnBody (node:_http_common:141:24)
[HTTP] <-- POST /session/12fb49f1-fe10-4ba8-b828-cefc939c5e8c/appium/device/push_file - - ms - -
[HTTP] 
BadRequestError: request aborted
    at IncomingMessage.onAborted (C:\Users\rajdeep.dodiya\AppData\Roaming\npm\node_modules\appium\node_modules\raw-body\index.js:238:10)
    at IncomingMessage.emit (node:events:527:28)
    at IncomingMessage._destroy (node:_http_incoming:179:10)
    at _destroy (node:internal/streams/destroy:102:25)
    at IncomingMessage.destroy (node:internal/streams/destroy:64:5)
    at abortIncoming (node:_http_server:602:9)
    at socketOnClose (node:_http_server:596:3)
    at Socket.emit (node:events:539:35)
    at TCP.<anonymous> (node:net:709:12)
ERROR: Error communicating with the remote browser. It may have died.
Build info: version: '4.7.0', revision: '0a5b49d16f'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '18'
Driver info: io.appium.java_client.android.AndroidDriver

Environment

* Java client build version: 8.3.0
* Appium server version:: 2.0.0-beta.52
* Node.js version: v16.15.1
* Mobile platform/version under test: API 33
* Real device or emulator/simulator: Real device

Any help? Is it because my file size is too big? I tried driver.pushFile() for a smaller zip file and it worked.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Java driver's pushFile entry point to the POST /session/.../appium/device/push_file endpoint shown in the report. Reproduce with the smaller and 900 MB zip files, then inspect how the request body is handled around the reported raw-body error. Done means identifying a supported fix or documenting the file-size limitation and its expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.