TypeError: Cannot call method 'uninstallApk' of null

I am getting the above error when running towards an Android (4.4.4) device. I use the java-client (1.7.0) on MAC and do something like this in my code:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("app", cfg.getAppPath());
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("appPackage", "com.something.sample");
capabilities.setCapability("appActivity", "SomeActivity");
AppiumDriver appium = new AppiumDriver(cfg.getAppiumUrl(), capabilities);
   
// do something....
// then
appium.closeApp();
appium.quit();

When calling the quit() method an exception is thrown. And the below is showing in the Appium log window. What can be the cause of this?

info: Stopping logcat capture

debug: Logcat terminated with code null, signal SIGTERM

info: [BOOTSTRAP] [info] Got data from client: {"cmd":"shutdown"}

info: [BOOTSTRAP] [info] Got command of type SHUTDOWN
info: [BOOTSTRAP] [info] Returning result: {"value":"OK, shutting down","status":0}
info: [BOOTSTRAP] [info] Closed client connection
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [UIAUTOMATOR STDOUT] Time: 8.212
info: [UIAUTOMATOR STDOUT] OK (1 test)
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: Sent shutdown command, waiting for UiAutomator to stop...

info: UiAutomator shut down normally
info: Cleaning up android objects
info: Responding to client with success: {"status":0,"value":"Successfully closed the [/Users/<my-user>/apks/MyApp-debug-signed.apk] app.","sessionId":"6045fba9-cf26-48c2-b43c-265f9d3d6bd6"}
POST /wd/hub/session/6045fba9-cf26-48c2-b43c-265f9d3d6bd6/appium/app/close 200 3075ms - 168b

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {"status":0,"value":{"build":{"version":"1.1.0","revision":"e433bbc31511f199287db7724e1ce692bcb32117"}},"sessionId":"6045fba9-cf26-48c2-b43c-265f9d3d6bd6"}

debug: Request received with params: {}

GET /wd/hub/status 200 1ms - 198b

debug: Appium request initiated at /wd/hub/session/6045fba9-cf26-48c2-b43c-265f9d3d6bd6

info: Shutting down appium session...

debug: Request received with params: {}

info: Removing app from device
DELETE /wd/hub/session/6045fba9-cf26-48c2-b43c-265f9d3d6bd6 500 3ms - 104b

TypeError: Cannot call method 'uninstallApk' of null
    at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:406:14)
    at androidCommon.uninstallApp (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:417:5)
    at Android.stop (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android.js:372:10)
    at Appium.stop (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/appium.js:381:15)
    at exports.deleteSession (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:205:14)
    at callbacks (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:164:37)
    at param (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:138:11)
    at param (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:135:11)
    at pass (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:145:5)
    at nextRoute (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:100:7)

Anyone seen this before? I’m also getting this on Windows now, using Appium v1.2.3.

Hi!
We’ve faced to this problem as well. May be you have found some fix for this?