I think I see two problems here – if I’m wrong, please forgive my misinterpretation
-
You need to set the appPackage capability when you start Appium. From the description above, you may not be setting that capability – that would describe the return of “null” from capabilities
-
Get the appPackage for whatever is running on the device at that moment.
In both cases, You can do this with aapt:
% aapt dump badging |grep package:
package: name=’<app_package>’ versionCode=’’ versionName=’<version_name>’