Help! "Activity used to start app doesn't exist! Make sure it exists"

2,098 views
Skip to first unread message

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 9:31:10 AM2/25/14
to appium-...@googlegroups.com
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist! Make sure it exists
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Activity used to start app doesn't exist! Make sure it exists)","origValue":"Activity used to start app doesn't exist! Make sure it exists"},"sessionId":null}

- INFO & LOGS-

Capabilities
desired_caps = {}
desired_caps['device'] = 'android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2.2'
desired_caps['app'] = PATH('/home/joel/fantasy/Fantasy-debug.apk')
desired_caps['app-package'] = 'com.coolapz.Fantasy'
desired_caps['app-activity'] = '.Fantasy'

joel@joel:~/fantasy$ aapt dump badging /home/joel/fantasy/Fantasy-debug.apk
package: name='com.coolappz.Fantasy' versionCode='1' versionName='1.0.0'
uses-permission:'android.permission.INTERNET'
application-label:'Fantasy'
application-icon-120:'res/drawable-ldpi/icon.png'
application-icon-160:'res/drawable-mdpi/icon.png'
application-icon-240:'res/drawable-hdpi/icon.png'
application-icon-320:'res/drawable-xhdpi/icon.png'
application: label='Fantasy' icon='res/drawable-mdpi/icon.png'
application-debuggable
launchable-activity: name='com.coolappz.Fantasy.Fantasy'  label='Fantasy' icon=''
sdkVersion:'10'
targetSdkVersion:'17'
uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission:'android.permission.READ_CONTACTS'
uses-permission:'android.permission.WRITE_CONTACTS'
uses-permission:'android.permission.GET_ACCOUNTS'
uses-permission:'android.permission.ACCESS_COARSE_LOCATION'
uses-permission:'android.permission.ACCESS_FINE_LOCATION'
uses-permission:'android.permission.ACCESS_NETWORK_STATE'
uses-permission:'android.permission.VIBRATE'
uses-permission:'android.permission.RECORD_AUDIO'
uses-permission:'android.permission.RECORD_VIDEO'
uses-permission:'android.permission.MODIFY_AUDIO_SETTINGS'
uses-permission:'android.permission.READ_PHONE_STATE'
uses-permission:'android.permission.READ_EXTERNAL_STORAGE'
uses-implied-permission:'android.permission.READ_EXTERNAL_STORAGE','requested WRITE_EXTERNAL_STORAGE'
uses-feature:'android.hardware.location'
uses-implied-feature:'android.hardware.location','requested a location access permission'
uses-feature:'android.hardware.location.gps'
uses-implied-feature:'android.hardware.location.gps','requested android.permission.ACCESS_FINE_LOCATION permission'
uses-feature:'android.hardware.location.network'
uses-implied-feature:'android.hardware.location.network','requested android.permission.ACCESS_COURSE_LOCATION permission'
uses-feature:'android.hardware.microphone'
uses-implied-feature:'android.hardware.microphone','requested android.permission.RECORD_AUDIO permission'
uses-feature:'android.hardware.touchscreen'
uses-implied-feature:'android.hardware.touchscreen','assumed you require a touch screen unless explicitly made optional'
main
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--'
densities: '120' '160' '240' '320'

Appium Log
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"sessionId":null,"desiredCapabilities":{"app-package":"com.coolapz.Fantasy","app":"/home/joel/fantasy/Fantasy-debug.apk","browserName":"","version":"4.2.2","device":"android","app-activity":".Fantasy"}}
info: Using local app from desiredCaps: /home/joel/fantasy/Fantasy-debug.apk
info: Creating new appium session 302c373f-a285-4761-863b-fbb649be3f97
info: Starting android appium
debug: Using fast reset? true
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from /home/joel/android-sdk-linux/platform-tools/adb
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" devices
info: [ADB] 1 device(s) connected
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5)
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 wait-for-device
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "echo 'ready'"
info: Starting logcat capture
info: Getting device API level
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: Device is at API Level 17
debug: java -jar "/home/joel/appium/lib/devices/android/helpers/strings_from_apk.jar" "/home/joel/fantasy/Fantasy-debug.apk" "/tmp/com.coolapz.Fantasy"
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 push "/tmp/com.coolapz.Fantasy/strings.json" /data/local/tmp
debug: Not uninstalling app since server not started with --full-reset
info: MD5 for app is d9d8629201140f66e6ec8d3e2a42b71b
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "ls /data/local/tmp/d9d8629201140f66e6ec8d3e2a42b71b.apk"
debug: Getting install status for com.coolapz.Fantasy
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "pm list packages -3 com.coolapz.Fantasy"
info: [ADB] App is not installed
debug: Checking app cert for /home/joel/fantasy/Fantasy-debug.apk: java -jar "/home/joel/appium/lib/devices/android/helpers/verify.jar" "/home/joel/fantasy/Fantasy-debug.apk"
debug: App already signed.
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "mkdir -p /data/local/tmp/"
info: Removing any old apks
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "ls /data/local/tmp/*.apk"
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell rm "/data/local/tmp/42d1731222eded1b6ce4d99dae8a6c0c.apk"
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 push "/home/joel/fantasy/Fantasy-debug.apk" /data/local/tmp/d9d8629201140f66e6ec8d3e2a42b71b.apk
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "pm install -r /data/local/tmp/d9d8629201140f66e6ec8d3e2a42b71b.apk"
info: [ADB] Forwarding system:4724 to device:4724
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 forward tcp:4724 tcp:4724
debug: Pushing appium bootstrap to device...
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 push "/home/joel/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/
debug: Pushing unlock helper app to device...
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 install /home/joel/appium/build/unlock_apk/unlock_apk-debug.apk
info: Attempting to kill all 'uiautomator' processes
info: Getting all processes with 'uiautomator'
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "ps 'uiautomator'"
info: No matching processes found
info: Running bootstrap
debug: spawning: /home/joel/android-sdk-linux/platform-tools/adb -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [BOOTSTRAP] [info] Socket opened on port 4724
info: [BOOTSTRAP] [info] Appium Socket Server Ready
info: [BOOTSTRAP] [info] Loading json...
debug: Waking up device if it's not alive
info: Pushing command to appium work queue: ["wake",{}]
info: [BOOTSTRAP] [info] json loading complete.
info: [BOOTSTRAP] [info] Registered crash watchers.
info: [BOOTSTRAP] [info] Client connected
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [BOOTSTRAP] [info] Got command of type ACTION
info: [BOOTSTRAP] [debug] Got command action: wake
info: [BOOTSTRAP] [info] Returning result: {"value":true,"status":0}
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "dumpsys window"
info: Writing dumpsys output to /home/joel/appium/.dumpsys.log
debug: Screen is locked, trying to unlock
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "dumpsys window"
info: Writing dumpsys output to /home/joel/appium/.dumpsys.log
debug: Screen is locked, trying to unlock
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "dumpsys window"
info: Writing dumpsys output to /home/joel/appium/.dumpsys.log
debug: Screen is unlocked, continuing
debug: executing: "/home/joel/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.coolapz.Fantasy/.Fantasy"
error: Activity used to start app doesn't exist! Make sure it exists
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"shutdown"}
info: [BOOTSTRAP] [info] Got command of type SHUTDOWN
info: [BOOTSTRAP] [info] Returning result: {"value":"OK, shutting down","status":0}
info: [BOOTSTRAP] [info] Closed client connection
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: Sent shutdown command, waiting for UiAutomator to stop...
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [UIAUTOMATOR STDOUT] Time: 13.201
info: [UIAUTOMATOR STDOUT] OK (1 test)
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: UiAutomator shut down normally
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist! Make sure it exists
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Activity used to start app doesn't exist! Make sure it exists)","origValue":"Activity used to start app doesn't exist! Make sure it exists"},"sessionId":null}
POST /wd/hub/session 500 23235ms - 272b

Ray Res

unread,
Feb 25, 2014, 9:44:41 AM2/25/14
to appium-...@googlegroups.com
Hi,

Possibly this bit is the problem:

desired_caps['app-activity'] = '.Fantasy'

I believe you need to specify the entire path(?) for the activity e.g.

desired_caps['app-activity'] = 'test.application.ui.fantasy'

You can use mobile: currentActivity to get the current Activity, if you have no other means.

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 9:57:16 AM2/25/14
to appium-...@googlegroups.com
Thanks! I'll try this and let you know.

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 10:03:33 AM2/25/14
to appium-...@googlegroups.com
Alright, so I tried using:
desired_caps['app-activity'] = 'com.coolapz.Fantasy.fantasy'
desired_caps['app-activity'] = 'test.application.ui.Fantasy'
desired_caps['app-activity'] = 'test.application.ui.fantasy'

They all failed with the same error ("Activity used to start app doesn't exists! Make sure it exists"). How can I implement the mobile: currentActivity in Python?

Thanks in advance!

On Tuesday, February 25, 2014 10:44:41 AM UTC-4, Ray Res wrote:

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 10:05:26 AM2/25/14
to appium-...@googlegroups.com
Also tried:
desired_caps['app-activity'] = 'com.coolapz.Fantasy.Fantasy'

Same as before.

Ray Res

unread,
Feb 25, 2014, 10:19:22 AM2/25/14
to appium-...@googlegroups.com
Sorry, 'test.application.ui.fantasy' was just my example.

You need to replace 'test.application.ui.' with the actual path to your .Fantasy Activity.

From the logs, Appium appears to be assuming that your full activity path is com.coolapz.Fantasy/.Fantasy

'com.coolapz.Fantasy' is defined as your package name.  Are you sure this is the correct path for the .Fantasy Activity?

You have to find out if you don't know for sure - and that's another topic.

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 10:26:28 AM2/25/14
to appium-...@googlegroups.com
Yes. On the aapt dump we can see this:
package: name='com.coolappz.Fantasy' versionCode='1' versionName='1.0.0'
[ ... ]
launchable-activity: name='com.coolappz.Fantasy.Fantasy'  [...]

How can I use mobile: currentActivity to get the current activity, as you suggested?

Ray Res

unread,
Feb 25, 2014, 10:59:32 AM2/25/14
to appium-...@googlegroups.com
Ah, ok interesting.

'mobile: currentActivity' may not help you achieve the starting Activity.  I've only ever used it after an app has launched.  Anyway, it can be used like this (in Python):

currentActivity = driver.execute_script("mobile: currentActivity")
print currentActivity

The only other way I've, so far, found the starting Activity for an app, was to run the APK Info app form Android Market place.  I'm sure there are better ways though.

Good luck!

joel.l...@nexoglobal.com

unread,
Feb 25, 2014, 11:03:09 AM2/25/14
to appium-...@googlegroups.com
Thanks Ray. 

I'm part of the developing team for this app. I've verify both with the XML of the project and the aapt command the starting activity for the app. It's just very strange that it says it doesn't exists.

joel.l...@nexoglobal.com

unread,
Feb 26, 2014, 10:46:41 AM2/26/14
to appium-...@googlegroups.com
I still can't figure out what's going on with this thing. I even updated to Appium 0.16.0 to see if it would help, and nothing. Still can't get my app to work, on neither Android nor Selendroid mode (it's a hybrid app, but as I understand, it should be able to install and launch and attempt the test even if it's in Android mode).

If I run the test for android, it breaks with A new session could not be created. (Original error: Activity used to start app doesn't exist! Make sure it exists, even tho I've verified the activity with both the source code and the aapt command.

When running the test for selendroid, it breaks with A new session could not be created. (Original error: android.util.AndroidException: INSTRUMENTATION_FAILED...

I'm at a dead end here. Any ideas anyone?

joel.l...@nexoglobal.com

unread,
Feb 26, 2014, 3:35:01 PM2/26/14
to appium-...@googlegroups.com
I've been checking things around, trying to catch why is it that Appium wouldn't load the app, saying that the Activity doesn't exist, and I came to find this:

Appium command: adb -s emulator-5554 shell am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.coolapz.Fantasy/.Fantasy
Regular command: adb -s emulator-5554 shell am start -W -a android.intent.action.MAIN -n com.coolappz.Fantasy/.Fantasy

Appium's command fails saying "Error type 3 Error: Activity class {com.coolapz.Fantasy/com.coolapz.Fantasy.Fantasy} does not exist.". The regular command launches the app successfully.

Any ideas why?

Ling-Yi Kung

unread,
Feb 26, 2014, 8:04:25 PM2/26/14
to appium-...@googlegroups.com
What are you passing for your capabilities now? From your apk dump, your package name is com.coolappz.Fantasy and your launchable activity is com.coolappz.Fantasy.Fantasy. Therefore, this should work:

desired_caps = {}
desired_caps['device'] = 'android'
desired_caps['version'] = '4.2.2'
desired_caps['app'] = PATH('/home/joel/fantasy/Fantasy-debug.apk')
desired_caps['app-package'] = 'com.coolapz.Fantasy'
desired_caps['app-activity'] = 'com.coolappz.Fantasy.Fantasy'

If it doesn't, which Appium version are you using? Try the latest, 0.16.0. There was a bug in detecting package names a few versions back.

Jonathan Lipps

unread,
Feb 26, 2014, 8:08:12 PM2/26/14
to Ling-Yi Kung, appium-...@googlegroups.com
Looks like you had 'coolapz' in one and 'coolappz' in another.

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Ling-Yi Kung

unread,
Feb 26, 2014, 8:23:15 PM2/26/14
to appium-...@googlegroups.com, Ling-Yi Kung
I copy-pasted the caps from his original post. Woops

desired_caps = {}
desired_caps['device'] = 'android'
desired_caps['version'] = '4.2.2'
desired_caps['app'] = PATH('/home/joel/fantasy/Fantasy-debug.apk')
desired_caps['app-package'] = 'com.coolappz.Fantasy'
desired_caps['app-activity'] = 'com.coolappz.Fantasy.Fantasy'

Or substitute 'coolappz' with 'coolapz', whichever one is actually correct. In your most recent error logs, you have 'coolapz', while your OP has 'coolappz'. I'm pretty sure that's not the actual name of your app, so just copy-paste from what `aapt dump badging` gives you - the name of your package and the launchable activity name.

joel.l...@nexoglobal.com

unread,
Feb 28, 2014, 8:26:43 AM2/28/14
to appium-...@googlegroups.com, Ling-Yi Kung
Thank you both, Jonathan and Ling-Yi. I was able to launch it by fixing the typo!
Reply all
Reply to author
Forward
0 new messages