# Android - installApp() throws "TypeError: path must be a string or Buffer"

**URL:** <https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221>\
**Category:** Issues/Bugs\
**Created:** [November 10, 2016, 2:27am UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221 "2016-11-10T02:27:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickD](https://discuss.appium.io/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@NickD](https://discuss.appium.io/u/NickD)\
**Post date:** [November 10, 2016, 2:27am UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221/1 "2016-11-10T02:27:36Z")

</div>

First off, thank you for creating such an awesome framework!

I’m running into an issue when I use the Android Driver (Java), the installApp() method seems to throw an exception. The Appium Server log is showing:

```
[HTTP] --> POST /wd/hub/session/d7fb104d-8861-4b4e-9234-90e045e6635a/appium/device/install_app {"appPath":"C:\\Users\\nick\\Projects\\Appium\\app\\MarketRelease-NO_DID-7.999.2385.apk"}
[MJSONWP] Calling AppiumDriver.installApp() with args: ["C:\\Users\\nick\\...
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.0\aapt.exe
[ADB] Extracting package and launch activity from manifest
[debug] [ADB] badging package: com.nick.myapp
[debug] [ADB] badging act: com.nick.gui.pivot.activities.PreLaunchActivity
[MJSONWP] Encountered internal error running command: TypeError: path must be a string or Buffer
    at TypeError (native)
    at Object.fs.open (fs.js:631:11)
    at ReadStream.open (fs.js:1936:6)
    at new ReadStream (fs.js:1923:10)
    ... full stack trace omitted ...

```

I’m running Appium Server v1.6.0 and Java binding: v4.1.2.

I’m also using the following desired capabilities:

- deviceName - “Android Emulator”
- app - app.getAbsolutePath()
- noReset - true
- autoLaunch - false

Let me know if you need any other details.

Thanks,

- Nick

---

<div class="post-metadata">

**Author:** ![NickD](https://discuss.appium.io/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@NickD](https://discuss.appium.io/u/NickD)\
**Post date:** [November 12, 2016, 11:59pm UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221/2 "2016-11-12T23:59:56Z")

</div>

Any thoughts on what might be causing this?

- Nick

---

<div class="post-metadata">

**Author:** ![upendraupadhyay](https://discuss.appium.io/letter_avatar_proxy/v4/letter/u/5daacb/32.png) [@upendraupadhyay](https://discuss.appium.io/u/upendraupadhyay)\
**Post date:** [November 19, 2016, 7:07am UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221/3 "2016-11-19T07:07:13Z")

</div>

Rename your apk to something that doesn’t have symbols or spaces. Only numbers and letters and ends in .apk.

Also post your capabilities

These are the ones i use for android.

platformName, platformVersion, deviceName, app, automationName, appWaitPackage, appActivity, appWaitActivity

---

<div class="post-metadata">

**Author:** ![NickD](https://discuss.appium.io/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@NickD](https://discuss.appium.io/u/NickD)\
**Post date:** [November 21, 2016, 11:47pm UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221/4 "2016-11-21T23:47:10Z")

</div>

My desired capabilities are listed in my original message.

I tried simplifying the APK file name and even the path- numbers and letters only. No luck.

I’ll try the capabilities you recommended later this week. Could you provide example values for each?

Thanks!

- Nick

---

<div class="post-metadata">

**Author:** ![upendraupadhyay](https://discuss.appium.io/letter_avatar_proxy/v4/letter/u/5daacb/32.png) [@upendraupadhyay](https://discuss.appium.io/u/upendraupadhyay)\
**Post date:** [November 22, 2016, 8:45am UTC](https://discuss.appium.io/t/android-installapp-throws-typeerror-path-must-be-a-string-or-buffer/13221/5 "2016-11-22T08:45:49Z")

</div>

File app= new File(“D:\apk\net.one97.paytm.5.4.2.apk”);  
DesiredCapabilities caps= new DesiredCapabilities();  
caps.setCapability(“app-package”, “net.one97.paytm”);  
caps.setCapability(“app-activity”, “com.urbanairship.actions.LandingPageActivity”);  
caps.setCapability(“deviceName”, “device\_one”);  
caps.setCapability(“platformName”, “Android”);  
caps.setCapability(“app”,app.getAbsolutePath());

```
	driver=new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"),caps);
```
