TestProject Forum

Generated java code for android stopped working with opensdk

A test is working fine in TP online. Tried to run generated code in eclipse but failed. Checked the generated code does not include valid strings for APP_PACKAGE, APP_ACTIVITY, and APP_FILE_PATH so generated code cannot start the app at the beginning in eclipse so the test failed. here is the generated code in setting up DesiredCapabilities -

    capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "YOUR_APP_PACKAGE");
    capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "YOUR_APP_ACTIVITY");
    capabilities.setCapability(MobileCapabilityType.APP, "APP_FILE_PATH");

Pls include valid strings for APP_PACKAGE, APP_ACTIVITY in the generated code to work with opensdk and run the test on the attached android phone.

The generated c# code does not include valid strings for AndroidPackage and AndroidActivity either.

		public static string AndroidPackage = "Your AndroidPackage";
		public static string AndroidActivity = "Your AndroidActivity";

Talked to the support team and was told to open a ticket with R&D team.

Thanks,
Ben

Hi @maob92,
If you are using the “from device” option, after generating code you should see a valid value in the android package and android activity capabilities.

If you are using an apk file, after generating code you should provide the file path to your apk file
In the APP_FILE_PATH capability.

Hi Tai, thanks for the quick reply!
For people facing same issue, the solution is
public static string AndroidPackage = "Your AndroidPackage"; public static string AndroidActivity = "Your AndroidActivity"; and
capabilities.setCapability(MobileCapabilityType.APP, "APP_FILE_PATH"); are mutually exclusive. you need to use either option.

Thanks,
Ben