7

I am testing my app using appium tool. During the process of testing, android app is crashing near launcher activity showing the following error only in some devices of version below 8. How to fix it?

An unknown server-side error occurred while processing the command. Original error: Cannot start the "com.bodaty.samyata.samyata09.login.launcheractivity" or "com.bodaty.samyata.samyata09.com.bodaty.samyata.samyata09.login.launcheractivity" never started.

[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[ADB] Getting focused package and activity
[ADB] Running '/Users/Anusha/Library/Android/sdk/platform-tools/adb -P 5037 -s a035f0de shell dumpsys window windows'
[ADB] Found package: 'com.bodaty.samyata.samyata09' and fully qualified activity name : 'com.bodaty.samyata.samyata09.login.MainPhone'
[ADB] Incorrect package and activity. Retrying.
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[JSONWP Proxy] Matched '/' to command name 'deleteSession'
[JSONWP Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/f30fa70a-c42e-45ab-bf24-5a07755da6e4] with no body

desired capabilities

{
  "platformName": "Android",
  "platformVersion": "6.0.1",
  "deviceName": "Vivi Vivo 1606",
  "automationName": "UiAutomator2",
  "app": "/Users/Anusha/Downloads/samyata.apk"
}
Saif Siddiqui
  • 856
  • 1
  • 13
  • 33
lasya valiveti
  • 251
  • 3
  • 12
  • How did you define your desired capabilities and AppiumDriver? Can you upload your code too? – Suban Dhyako Nov 15 '18 at 06:27
  • yes , I have uploaded desired capabilities too @SubanDhyako – lasya valiveti Nov 15 '18 at 06:33
  • What is your appPackgae and appActivity? The above log is showing Incorrect package and activity. – Suban Dhyako Nov 15 '18 at 06:41
  • my actual package name is com.bodaty.samyata.samyata09 – lasya valiveti Nov 15 '18 at 06:42
  • @lasyavaliveti - as per error package name and launch able activity name you are passing is incorrect. Try below command where `adb` is configured `adb shell` `pm list packages -f | grep "samyata"` – Amit Jain Nov 15 '18 at 06:51
  • is there anything to change or check the package name while passing before generating apk? @AmitJain – lasya valiveti Nov 15 '18 at 06:57
  • @lasyavaliveti - If you manually install the apk in android device and run the command I have shared it will show package name. – Amit Jain Nov 15 '18 at 07:00
  • will that command run in iMac too? @AmitJain – lasya valiveti Nov 15 '18 at 07:03
  • yes, I have given the same command and my package name is showing correct. package:/data/app/com.bodaty.samyata.samyata09-1/base.apk=com.bodaty.samyata.samyata09. @AmitJain – lasya valiveti Nov 15 '18 at 08:56
  • Similarly find launch able activity once - 1. run command `adb shell` 2. `logcat | grep "samyata" ` 3. manually launch app in connected device and see in logs the correct name of launchable activity and pass in code and see if it is working @lasyavaliveti – Amit Jain Nov 15 '18 at 09:20

1 Answers1

4

In the above error desired Capabilities "appActivity" and "appPackage" are not defined which are necessary for the app to launch.

Modify the desired capabilities in the Appium Inspector like below by finding your "appActivity" and "appPackage" if you are inspecting element

{
  "platformName": "Android",
  "deviceName": "Motorola",
  "app": "/Users/saif.siddiqui/Desktop/SaifLearning/src/test/resources/app/Todoist_v12.8_apkpure.com.apk",
  "noReset": true,
  "appActivity": "com.todoist.activity.HomeActivity",
  "appPackage": "com.todoist",
  "automatioName": "uiautomator2"
}

If you are running the Test cases and then you are getting the error then Modify your desired Capabilities in the code accordingly like below:

    caps.setCapability("platformName", platformName);
    caps.setCapability("deviceName", deviceName);
    caps.setCapability("app", uri);
    caps.setCapability("noReset", true);
    URL remoteUrl = new URL("http://localhost:4723/wd/hub");
    caps.setCapability("appPackage", "com.todoist"); 
    caps.setCapability("appActivity","com.todoist.activity.HomeActivity"); 
    driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); 
Saif Siddiqui
  • 856
  • 1
  • 13
  • 33