Android on appium 1.6: 'Incorrect package and activity.' error

I tested the same code that’s running correctly against appium 1.5.3 against 1.6.0beta3, and when I try to start my test I get the following error:

[debug] [ADB] Found package: 'com.siplay.android_siplay' and activity: '.ui.activity.IntroSlideShowActivity'
[debug] [ADB] Incorrect package and activity. Retrying.
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/matiasmatteucci/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","4d002ce33f5160d1","shell","dumpsys","window","windows"]
[debug] [ADB] Found package: 'com.siplay.android_siplay' and activity: '.ui.activity.IntroSlideShowActivity'
[debug] [ADB] Incorrect package and activity. Retrying.
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/matiasmatteucci/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","4d002ce33f5160d1","shell","dumpsys","window","windows"]
[debug] [ADB] Found package: 'com.siplay.android_siplay' and activity: '.ui.activity.IntroSlideShowActivity'
[debug] [ADB] Incorrect package and activity. Retrying.
[ADB] Error: com.siplay.android_siplay/com.siplay.android_siplay.ui.activity.SplashActivity or .ui.activity.SplashActivity or .com.siplay.android_siplay.ui.activity.SplashActivity never started

I’m guessing that for some reason appium 1.5.3 is picking the correct appActivity while 1.6.0beta3 is not? I don’t have appActivity specified on my capabilities btw.

Edit: I did some more research around this. Seems that for reason appium is looking for ‘.ui.activity.SplashActivity’ which is the correct main activity, but is only able to find ‘.ui.activity.IntroSlideShowActivity’ which I assume is the splash screen activity. This happens even when the splash screen is already gone and the main activity has started (it keeps spamming that the only activity it finds is ‘.ui.activity.IntroSlideShowActivity’ until it eventually it stops retrying)

Main question is why is this working correctly in 1.5.3 and not in 1.6.0?

2 Likes

Any solutions you have found about this @matias? I have exactly the same problem on 1.6.0 released version.

Yes. I talked to the people developing the app I’m testing and in this particular case, the Splash activity is a “router”. Solution was to force IntroSlideShowActivity as appActivity:

capabilities.setCapability("appActivity", ".ui.activity.IntroSlideShowActivity");

We were facing the same issue with Appium 1.6.

Our workaround is to go back to 1.5 :wink:

1 Like

You may add as many activities as you wish in driver capabilities using comma. One of needed activity appears (even incorrect that appium looking for) and appium get relaxed.

Thanks. We made it work by adding this new capability that it was not finding. Actually it’s our app’s main activity after normal splash actıvity.

But still appium should have found this automatically as 1.5.3. It has to be developed

1 Like

Thanks for the solution, issue still exists with appium 1.6.4 and your solution works perfectly.

Regards,
Vikram

What worked for me was adding this capability (available since Appium 1.6.5):
capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "your.package.name.*");

See the following discussion for more details: Incorrect package and activity. Retrying in Appium 1.6.4

3 Likes

Adding wild cards * -“your.package.name.*” worked for me to

I tried with this solution,even with different Appium versions 1.7.1,1.7.0 , 1.6 and 1.5. still I am facing issue

I also tried with appium 1.6, 1.7, 1.7.1, 1.7.2 beta and nothing… any other solution for this problem, please?

I could solved the problem.

Add the capabilities:

capabilities.setCapability(“appPackage”, “com.your.package”);
capabilities.setCapability(“appActivity”, “com.your.package.MainActivity”);

Forget about waitAppActivity (it doesn’t work for me) and this solved my problem.

PS: In case you don’t know where to find the appPackage or the appActivity who launch the app: http://toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/

1 Like

I have tried all the possibilities such as with appWaitActivity, without appWaitActivity still the same problem. If I uninstall the application it will work fine but If I want to keep batch execution that time it will not work and also I tried with noReset capability

Are you getting ‘Incorrect package and activity’ error?

In my latest project I had to set appActivity to the splash activity and appWaitActivity to the onboarding activity.

Added below and solved my problem.

capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, “your.package.name.*”);

Hi @Aleksei, would you pls mind to site an handy example, how we can add more than 1 capabilities with comma?

@ahsan better use “*” as mentioned above. It will cover any activity of your app.

@ahsan but just in case:

capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, “your.package.name.Acivity1,your.package.name.Acivity2”);
1 Like