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

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

Any thoughts on what might be causing this?

  • Nick

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

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

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