Selendroid: Encountered internal error running command: TypeError: Cannot read property 'platform' of null (Issue generating AndroidManifest)

We found an issue running some older tests that use Selendroid.

It is important to note this approach works with automationName: Appium without an issue.
Andoird sdk was installed via brew.
brew cask install android-sdk
This works well but is missing platform-tools. These are installed via the new(ish) sdkmanager
sdkmanager “platform-tools”

The symptom: When trying to Compile the new manifest this would happen.
error: [MJSONWP] Encountered internal error running command: TypeError: Cannot read property ‘platform’ of null
at ADB.callee$0$0$ (…/…/…/lib/tools/android-manifest.js:122:16)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

The issue: The root of the issue was lack of installed android platforms. e.g: sdkmanager “platform:andoird-25”.
the resulting “null” in the debug log comes from the “platform” being null on line 124 in android-manifest.js. There is no null handler, however getAndroidPlatformAndPath() from helper.js will return null if no android platforms exist. See the top of helper.js for a list of platforms (currently missing android-26).

The solution: The solution is to install atleast 1 android platform via sdk manager. Use sdkmanager “platforms;android-25” or any specific version you need.

or run with automaitonName: Appium.