[Android] Hybrid app issue

Hey guys, I’m having an issue with getting Appium to work on what I believe is a “hybrid” Android app. Let’s call it “App A.”

App A’s main purpose is to launch another app (App B).

So App A has it’s own package name and launchable activity; as does App B.

When I use Appium, App A successfuly launches but I then get the following error:

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity)”,“origValue”:“com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 28447.541 ms - 298

error: Failed to start an Appium session, err was: Error: com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity

Is there a way to somehow just launch App A and run my tests against App B? (I know simply setting the desired capabilities to App B would do the job but it’s super important that I include App A as part of my test coverage.)

Appium launches the application specified in your capabilities (app_package). It then verifies that the current activity matches the expected value (app_activity). It looks like AppA starts AppB so quickly that Appium doesn’t detect AppA started. You could try changing your app_activity to AppB’s activity and see if that fixes your problem. If it works, I don’t want credit for this hack :smile:

Thanks for the insight! I tried your suggestion but it unfortunately didn’t work. I’m getting this error message instead:

info: [debug] Error: com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/adb.js:1314:12)
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/adb.js:1258:7)
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/lib/adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity)”,“origValue”:“com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 30153.187 ms - 298

error: Failed to start an Appium session, err was: Error: com.jerunai.appA/.MainActivity never started. Current: com.jerunai.appB/.MainActivity

As luck would have it, we had a similar problem we had to explore after I responded to you earlier, but ours was simpler. The launch activity wouldn’t show up for very long on a simulator, so appium would miss it. The app would change its activity and Appium would fail to launch. On a real device, it wasn’t quite as fast.

You’ve forced me to review the appium documentation. I found this capability which I think is what you want:
appWaitActivity. You might want to also explore the appWaitPackage. See http://appium.io/slate/en/v1.0.0/?ruby#appium-server-capabilities for some meager documentation on these two capabilities.

1 Like

Sorry for the late reply. In addition to appWaitActivity, I also needed to add appWaitPackage.

With those capabilities, I was able to successfully test the hybrid app. Thank you so much!

1 Like