Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new session could not be created. (Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity) #2981

Closed
RanjitGupta opened this issue Jun 27, 2014 · 10 comments

Comments

@RanjitGupta
Copy link

Hi,

I am getting error as "A new session could not be created. (Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity)"

Can anyone let me know what might go wrong here

IWebDriver driver;

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.SetCapability(CapabilityType.BrowserName, "Android");
        capabilities.SetCapability(CapabilityType.Version, "4.3");
        capabilities.SetCapability(CapabilityType.Platform, "Windows");
       // capabilities.SetCapability("deviceName", "Android Emulator");
        //capabilities.SetCapability("appium-version", "1.1");
        capabilities.SetCapability("app", "D:\\android\\android\\sdk\\platform-tools\\AngularjsToDo-debug1.apk");//
        capabilities.SetCapability("app-package", "com.microsoft.madha.samples");
        //// This is package name of your app (you can get it from apk info app)
        capabilities.SetCapability("app-wait-activity", ".angularjstodo");
        capabilities.SetCapability("app-activity", ".AngularjsToDo"); 

        driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);

appium

Error logs

Starting Node Server

info: Welcome to Appium v1.1.0 (REV e433bbc)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: socket.io started
info: Non-default server args: {"app":"D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk","address":"127.0.0.1","logNoColors":true,"androidPackage":"com.microsoft.madha.samples.angularjstodo","androidActivity":".AngularjsToDo","platformName":"Android","platformVersion":"18","automationName":"Appium"}
ERROR: debug: Appium request initiated at /wd/hub/session
ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"Android","version":"4.3","platform":"Windows","app":"D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk"}}
info: Creating new appium session cee3ec70-fcf9-4c27-92bb-bffd6bf5e86e
info: Starting android appium
info: Preparing device for session
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" devices
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from D:\android\android\sdk\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
info: [ADB] 1 device(s) connected
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5)
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: Starting logcat capture
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: Device is at API Level 19
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
ERROR: debug: Current device language: en
ERROR: debug: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\strings_from_apk.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk" "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo" en
ERROR: debug: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\strings_from_apk.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk" "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 push "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo\strings.json" /data/local/tmp
info: Checking whether aapt is present
ERROR: debug: Set app process to: s.angularjstodo
ERROR: debug: Not uninstalling app since server not started with --full-reset
ERROR: debug: Checking app cert for D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\verify.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk"
ERROR: debug: App already signed.
info: Zip-aligning D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk
ERROR: debug: zipAlignApk: "D:\android\android\sdk\tools\zipalign.exe" -f 4 "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk" "C:\Users\rankumar\AppData\Local\Temp\appium114527-8848-i82ef7.tmp"
info: [ADB] Using zipalign from D:\android\android\sdk\tools\zipalign.exe
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk"
ERROR: debug: Getting install status for com.microsoft.madha.samples.angularjstodo
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.microsoft.madha.samples.angularjstodo"
info: [ADB] App is not installed
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "mkdir -p /data/local/tmp/"
info: Removing any old apks
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/_.apk"
info: Found an apk we want to keep at /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop com.microsoft.madha.samples.angularjstodo"
info: Couldn't find any apks to remove
info: Uninstalling com.microsoft.madha.samples.angularjstodo
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 uninstall com.microsoft.madha.samples.angularjstodo
ERROR: debug: App was not uninstalled, maybe it wasn't on device?
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm install -r /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
ERROR: debug: Pushing appium bootstrap to device...
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 push "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
ERROR: debug: Pushing unlock helper app to device...
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 install "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: Getting all processes with 'uiautomator'
info: No matching processes found
ERROR: debug: spawning: D:\android\android\sdk\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: Running bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [BOOTSTRAP] [info] Socket opened on port 4724
info: [BOOTSTRAP] [info] Appium Socket Server Ready
ERROR: debug: Waking up device if it's not alive
info: [BOOTSTRAP] [info] Loading json...
info: [BOOTSTRAP] [info] json loading complete.
info: Pushing command to appium work queue: ["wake",{}]
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}
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window"
info: Writing dumpsys output to D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium.dumpsys.log
ERROR: debug: Screen already unlocked, continuing.
info: Pushing command to appium work queue: ["getDataDir",{}]
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [BOOTSTRAP] [info] Got command of type ACTION
info: [BOOTSTRAP] [debug] Got command action: getDataDir
info: [BOOTSTRAP] [info] Returning result: {"value":"/data","status":0}
ERROR: debug: dataDir set to: /data
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.microsoft.madha.samples.angularjstodo/.AngularjsToDo"
ERROR: error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
info: Stopping logcat capture
ERROR: debug: Logcat terminated with code null, signal SIGTERM
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"shutdown"}
info: Sent shutdown command, waiting for UiAutomator to stop...
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: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [UIAUTOMATOR STDOUT] Time: 5.726
info: [UIAUTOMATOR STDOUT] OK (1 test)
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: UiAutomator shut down normally
ERROR: error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
info: Cleaning up android objects
info: Cleaning up appium session
info: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
at null. (D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\adb.js:1112:19)
at D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\adb.js:153:5
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess.handle.onexit (child_process.js:810:5)
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 or cannot be launched! Make sure it exists and is a launchable activity)","origValue":"Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity"},"sessionId":null}
POST /wd/hub/session 500 27607ms - 374b
ERROR: debug: Appium request initiated at /wd/hub/session
info: Using local app from desired caps: D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk
ERROR: debug: Request received with params: {"desiredCapabilities":{"browserName":"Android","version":"4.3","platform":"Windows","app":"D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk","app-package":"com.microsoft.madha.samples","app-wait-activity":".angularjstodo","app-activity":".AngularjsToDo"}}
info: Creating new appium session 0ecdeadd-a102-4cc8-9a80-9ca4331d46b6
info: Starting android appium
info: Preparing device for session
info: Checking whether app is actually present
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" devices
info: Checking whether adb is present
info: [ADB] Using adb from D:\android\android\sdk\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
info: [ADB] 1 device(s) connected
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5)
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: Starting logcat capture
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: Device is at API Level 19
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
ERROR: debug: Current device language: en
ERROR: debug: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\strings_from_apk.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk" "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo" en
ERROR: debug: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\strings_from_apk.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk" "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 push "C:\Windows\Temp\com.microsoft.madha.samples.angularjstodo\strings.json" /data/local/tmp
info: Checking whether aapt is present
ERROR: debug: Set app process to: s.angularjstodo
ERROR: debug: Not uninstalling app since server not started with --full-reset
ERROR: debug: Checking app cert for D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk: java -jar "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\helpers\verify.jar" "D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk"
info: Zip-aligning D:\android\android\sdk\platform-tools\AngularjsToDo-debug1.apk
info: Checking whether zipalign is present
info: [ADB] Using zipalign from D:\android\android\sdk\tools\zipalign.exe
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk"
ERROR: debug: Getting install status for com.microsoft.madha.samples.angularjstodo
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.microsoft.madha.samples.angularjstodo"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "mkdir -p /data/local/tmp/"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/
.apk"
info: Found an apk we want to keep at /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop com.microsoft.madha.samples.angularjstodo"
info: Couldn't find any apks to remove
info: Uninstalling com.microsoft.madha.samples.angularjstodo
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 uninstall com.microsoft.madha.samples.angularjstodo
ERROR: debug: App was not uninstalled, maybe it wasn't on device?
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "pm install -r /data/local/tmp/88ab4ab9181eea06e854a87d7b634cb8.apk"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
ERROR: debug: Pushing appium bootstrap to device...
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 push "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
ERROR: debug: Pushing unlock helper app to device...
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 install "D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: Getting all processes with 'uiautomator'
ERROR: debug: spawning: D:\android\android\sdk\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: Running bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [BOOTSTRAP] [info] Socket opened on port 4724
ERROR: debug: Waking up device if it's not alive
info: Pushing command to appium work queue: ["wake",{}]
info: [BOOTSTRAP] [info] Loading json...
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}
ERROR: debug: executing: "D:\android\android\sdk\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window"
info: Writing dumpsys output to D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium.dumpsys.log
ERROR: debug: Screen already unlocked, continuing.
info: Pushing command to appium work queue: ["getDataDir",{}]
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
ERROR: debug: dataDir set to: /data
info: [BOOTSTRAP] [debug] Got command action: getDataDir
info: [BOOTSTRAP] [info] Returning result: {"value":"/data","status":0}
info: Stopping logcat capture
ERROR: 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: Sent shutdown command, waiting for UiAutomator to stop...
info: [BOOTSTRAP] [info] Closed client connection
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [UIAUTOMATOR STDOUT] Time: 5.708
info: [UIAUTOMATOR STDOUT] OK (1 test)
info: [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: UiAutomator shut down normally
ERROR: error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
info: Cleaning up android objects
info: Cleaning up appium session
info: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
at null. (D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\adb.js:1112:19)
at D:\Initiative\AppiumForWindows-1.0.0\AppiumForWindows\node_modules\appium\lib\devices\android\adb.js:153:5
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
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 or cannot be launched! Make sure it exists and is a launchable activity)","origValue":"Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity"},"sessionId":null}
POST /wd/hub/session 500 28462ms - 374b

@paymand
Copy link
Member

paymand commented Jun 27, 2014

Most capabilities were renamed in Appium 1.0 (e.g. appActivity instead of app-activity). See:
https://github.com/appium/appium/blob/master/docs/en/caps.md

@RanjitGupta
Copy link
Author

I modified capabilities accordingly but still am facing the issue.
Can you please let me know what would be the value for activity, package and wait activity

Below information is displayed when I use apk info for my app

package

@paymand
Copy link
Member

paymand commented Jun 27, 2014

Don't know about the apk info tool above, but you can always get that info using the aapt tool from Android SDK with the following command:
adt/sdk/build-tools/android-4.4/aapt dump badging app.apk

Note: You shouldn't need to specify appPackage, appActivity, etc. since Appium should be able to extract those from the apk using the method above anyway.

@ghost
Copy link

ghost commented Jun 29, 2014

I got the same issue while I am learning Android application testing (.apk). if your apk works on the emulator by manually getting on to avd then no issues with .apk and the problem might something else. My guess would be your .apk is corrupted and unreadable. Please get another working .apk and give a try, before you do so, make sure to copy activity and package as exactly you see after executing command "aapt" from command line. Note: Give complete path for the activity, see below ex:

public class AppiumExampleTest {

private AppiumDriver driver = null;

@Before
public void setup() {


    File appDir = new File("D:\\Android_apk");
    File app = new File(appDir, "somexyz.apk");

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
    capabilities.setCapability(CapabilityType.VERSION, "4.4");
    capabilities.setCapability(CapabilityType.PLATFORM, "Andriod");
    capabilities.setCapability("Device" , "emulator-5554");
    capabilities.setCapability ("newCommandTimeout", "180"); 
    capabilities.setCapability("appPackage", "com.xyz.client.android.somexyz");
    capabilities.setCapability("appActivity", "com.xyz.client.android.refapp.modules.registration.RegistrationActivity");

    capabilities.setCapability("App", app.getAbsolutePath());;

    try {
        driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);

}

If it works, please update here so it is going to help others.

@RanjitGupta
Copy link
Author

Still am hitting the same issue...

This is the code am trying to run

IWebDriver driver;

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.SetCapability(CapabilityType.BrowserName, "");
        capabilities.SetCapability(CapabilityType.Version, "4.4");
        capabilities.SetCapability(CapabilityType.Platform, "Windows");
        capabilities.SetCapability("Device", "emulator-5554");
        capabilities.SetCapability("newCommandTimeout", "180"); 
       // capabilities.SetCapability("deviceName", "Android Emulator");
        //capabilities.SetCapability("appium-version", "1.1");
        capabilities.SetCapability("app", "D:\\android\\android\\sdk\\platform-tools\\AngularjsToDo-debug1.apk");//
        capabilities.SetCapability("apppackage", "com.microsoft.mdha.samples.angularjstodo");
        //// This is package name of your app (you can get it from apk info app)
       // capabilities.SetCapability("appwaitactivity", ".angularjstodo");
        capabilities.SetCapability("appactivity", ".AngularjsToDo");             
        driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);

Using aapt command I got below information about the apk.

D:\android\android\sdk\build-tools\android-4.4.2>aapt list -a D:\android\android
\sdk\platform-tools\AngularjsToDo-debug1.apk
AndroidManifest.xml
assets/_where-is-www.txt
assets/www/FetchRequirements.ps1
assets/www/Readme.txt
assets/www/cordova.js
assets/www/cordova_plugins.js
assets/www/css/index.css
assets/www/images/checkbox.png
assets/www/images/checkbox_checked.png
assets/www/images/delete.png
assets/www/index.html
assets/www/plugins/com.msopentech.azure-mobile-services/www/MobileServices.Web-1
.1.3.js
assets/www/plugins/com.msopentech.azure-mobile-services/www/MobileServices.Web.E
xt.js
assets/www/plugins/org.apache.cordova.inappbrowser/www/inappbrowser.js
assets/www/scripts/controllers.js
assets/www/scripts/directives.js
assets/www/scripts/index.js
assets/www/scripts/services.js
classes.dex
res/drawable-hdpi/ic_action_next_item.png
res/drawable-hdpi/ic_action_previous_item.png
res/drawable-hdpi/ic_action_remove.png
res/drawable-hdpi/icon.png
res/drawable-land-hdpi/screen.png
res/drawable-land-ldpi/screen.png
res/drawable-land-mdpi/screen.png
res/drawable-land-xhdpi/screen.png
res/drawable-ldpi/icon.png
res/drawable-mdpi/ic_action_next_item.png
res/drawable-mdpi/ic_action_previous_item.png
res/drawable-mdpi/ic_action_remove.png
res/drawable-mdpi/icon.png
res/drawable-port-hdpi/screen.png
res/drawable-port-ldpi/screen.png
res/drawable-port-mdpi/screen.png
res/drawable-port-xhdpi/screen.png
res/drawable-xhdpi/ic_action_next_item.png
res/drawable-xhdpi/ic_action_previous_item.png
res/drawable-xhdpi/ic_action_remove.png
res/drawable-xhdpi/icon.png
res/drawable-xxhdpi/ic_action_next_item.png
res/drawable-xxhdpi/ic_action_previous_item.png
res/drawable-xxhdpi/ic_action_remove.png
res/drawable/icon.png
res/xml/config.xml
resources.arsc
META-INF/MANIFEST.MF
META-INF/CERT.SF
META-INF/CERT.RSA

Resource table:
Package Groups (1)
Package Group 0 id=127 packageCount=1 name=com.microsoft.mdha.samples.angularjst
odo
Package 0 id=127 name=com.microsoft.mdha.samples.angularjstodo typeCount=4
type 0 configCount=0 entryCount=0
type 1 configCount=14 entryCount=5
spec resource 0x7f020000 com.microsoft.mdha.samples.angularjstodo:drawable
/ic_action_next_item: flags=0x00000100
spec resource 0x7f020001 com.microsoft.mdha.samples.angularjstodo:drawable
/ic_action_previous_item: flags=0x00000100
spec resource 0x7f020002 com.microsoft.mdha.samples.angularjstodo:drawable
/ic_action_remove: flags=0x00000100
spec resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable
/icon: flags=0x00000500
spec resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable
/screen: flags=0x00000180
config (default):
resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable/ic
on: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
config ldpi-v4:
resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable/ic
on: t=0x03 d=0x00000002 (s=0x0008 r=0x00)
config port-ldpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000003 (s=0x0008 r=0x00)
config land-ldpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000004 (s=0x0008 r=0x00)
config mdpi-v4:
resource 0x7f020000 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_next_item: t=0x03 d=0x00000005 (s=0x0008 r=0x00)
resource 0x7f020001 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_previous_item: t=0x03 d=0x00000007 (s=0x0008 r=0x00)
resource 0x7f020002 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_remove: t=0x03 d=0x00000008 (s=0x0008 r=0x00)
resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable/ic
on: t=0x03 d=0x00000006 (s=0x0008 r=0x00)
config port-mdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000009 (s=0x0008 r=0x00)
config land-mdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x0000000a (s=0x0008 r=0x00)
config hdpi-v4:
resource 0x7f020000 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_next_item: t=0x03 d=0x0000000b (s=0x0008 r=0x00)
resource 0x7f020001 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_previous_item: t=0x03 d=0x0000000d (s=0x0008 r=0x00)
resource 0x7f020002 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_remove: t=0x03 d=0x0000000e (s=0x0008 r=0x00)
resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable/ic
on: t=0x03 d=0x0000000c (s=0x0008 r=0x00)
config port-hdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x0000000f (s=0x0008 r=0x00)
config land-hdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000010 (s=0x0008 r=0x00)
config xhdpi-v4:
resource 0x7f020000 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_next_item: t=0x03 d=0x00000011 (s=0x0008 r=0x00)
resource 0x7f020001 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_previous_item: t=0x03 d=0x00000014 (s=0x0008 r=0x00)
resource 0x7f020002 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_remove: t=0x03 d=0x00000012 (s=0x0008 r=0x00)
resource 0x7f020003 com.microsoft.mdha.samples.angularjstodo:drawable/ic
on: t=0x03 d=0x00000013 (s=0x0008 r=0x00)
config port-xhdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000015 (s=0x0008 r=0x00)
config land-xhdpi-v4:
resource 0x7f020004 com.microsoft.mdha.samples.angularjstodo:drawable/sc
reen: t=0x03 d=0x00000016 (s=0x0008 r=0x00)
config xxhdpi-v4:
resource 0x7f020000 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_next_item: t=0x03 d=0x00000019 (s=0x0008 r=0x00)
resource 0x7f020001 com.microsoft.mdha.samples.angularjstodo:drawable/ic
_action_previous_item: t=0x03 d=0x00000017 (s=0x0008 r=0x00)
resource 0x7f020002 com.microsoft.mdha.samples.angularjstodo:drawable/ic
action_remove: t=0x03 d=0x00000018 (s=0x0008 r=0x00)
type 2 configCount=1 entryCount=1
spec resource 0x7f030000 com.microsoft.mdha.samples.angularjstodo:xml/conf
ig: flags=0x00000000
config (default):
resource 0x7f030000 com.microsoft.mdha.samples.angularjstodo:xml/config:
t=0x03 d=0x00000000 (s=0x0008 r=0x00)
type 3 configCount=1 entryCount=1
spec resource 0x7f040000 com.microsoft.mdha.samples.angularjstodo:string/a
pp_name: flags=0x00000000
config (default):
resource 0x7f040000 com.microsoft.mdha.samples.angularjstodo:string/app

name: t=0x03 d=0x0000001a (s=0x0008 r=0x00)

Android manifest:
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0.0" (Raw: "1.0.0.0")
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x20
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
A: package="com.microsoft.mdha.samples.angularjstodo" (Raw: "com.microsoft.m
dha.samples.angularjstodo")
E: supports-screens (line=3)
A: android:anyDensity(0x0101026c)=(type 0x12)0xffffffff
A: android:smallScreens(0x01010284)=(type 0x12)0xffffffff
A: android:normalScreens(0x01010285)=(type 0x12)0xffffffff
A: android:largeScreens(0x01010286)=(type 0x12)0xffffffff
A: android:resizeable(0x0101028d)=(type 0x12)0xffffffff
A: android:xlargeScreens(0x010102bf)=(type 0x12)0xffffffff
E: uses-permission (line=4)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.p
ermission.INTERNET")
E: application (line=5)
A: android:label(0x01010001)=@0x7f040000
A: android:icon(0x01010002)=@0x7f020003
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: activity (line=6)
A: android:theme(0x01010000)=@0x1030009
A: android:label(0x01010001)=@0x7f040000
A: android:name(0x01010003)="AngularjsToDo" (Raw: "AngularjsToDo")
A: android:configChanges(0x0101001f)=(type 0x11)0x4b4
E: intent-filter (line=7)
E: action (line=8)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "andr
oid.intent.action.MAIN")
E: category (line=9)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw:
"android.intent.category.LAUNCHER")
E: uses-sdk (line=13)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0xa
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x13
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.ACCESS_COARSE_LOCATION" (R
aw: "android.permission.ACCESS_COARSE_LOCATION")
E: uses-permission (line=15)
A: android:name(0x01010003)="android.permission.ACCESS_FINE_LOCATION" (Raw
: "android.permission.ACCESS_FINE_LOCATION")

@RanjitGupta
Copy link
Author

issue got resolved after I used appium version in the capability

capabilities.SetCapability("appium-version", "1.1");

thanks

@pushprajsingh05
Copy link

Below code installs the app but failed to open it in emulator.
Once it installed I see that app is working absolutely fine in emulator, when I manually play with it.
Code:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class WordPad {

WebDriver dr;

@Test
public void testApp() throws MalformedURLException, InterruptedException {
    String apkpath = "D:\\apkdump\\blackcarbon.wordpad.apk";
    File app = new File (apkpath);
    DesiredCapabilities capabilities= new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME,"");
    capabilities.setCapability("deviceName","Wordpad1");
    capabilities.setCapability("appium-version", "1.2.4.1");
    capabilities.setCapability("platformName","Android");
    capabilities.setCapability("app",app.getAbsolutePath());
    capabilities.setCapability("appPackage", "com.wordpad");
    capabilities.setCapability("appActivity", "com.wordpad.Main");
    dr = new AppiumDriver(new URL("http://******:4723/wd/hub"),capabilities);


    dr.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
    dr.quit();


}

}

Appium Console error:

info: [debug] UiAutomator shut down normally
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
at null. (D:\MobileTesting\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1143:21)
at null. (D:\MobileTesting\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:172:9)
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] 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 or cannot be launched! Make sure it exists and is a launchable activity)","origValue":"Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity"},"sessionId":null}
info: �[37m<-- POST /wd/hub/session �[39m�[31m500�[39m�[90m 51290.254 ms - 346�[39m �[90m�[39m

@sebv
Copy link
Member

sebv commented Nov 10, 2014

@RanjitGupta please do not go back to closed issues like that, if you have a new problem, open a new issue, and eventually reference it.

@Ashishkatkar
Copy link

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;

public class DesiredCapaTest {

@Test

public void f() throws MalformedURLException
{

  File appDir = new File("src");
	 
	File app = new File(appDir,"figaro-release.apk");
	DesiredCapabilities cap=new DesiredCapabilities();
    cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
    cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"5.1.1");
    cap.setCapability(MobileCapabilityType.DEVICE_NAME, "ZH8007G31B");
    cap.setCapability("appium-version","1.4.16.1");
    cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    cap.setCapability("appPackage", "com.philips.cl.di.figaro");
    cap.setCapability("appActivity","com.philips.cl.di.picasso.activity.SplashScreenActivity");
    AndroidDriver driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
    driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);

}

}

while running above code in eclipse getting error as "A new session could not be created. (Original error: zipAlignApk failed. Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "C:\Android\sdk\build-tools\25.0.1\zipalign.exe -f 4 G:\workspace\AppiumIntro\src\figaro-release.apk C:\Users\ASHISH~1\AppData\Local\Temp\117028-9348-xb9apu\appium.tmp"
W/zip ( 4832): copy of 'assets/BeardStyles/SCRUFFY_BEARD/Coat1_Darkest' failed"

Please help me on this....
Thanks in advance...

@lock
Copy link

lock bot commented Apr 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants