Getting A new session could not be created

Can anyone help me out I am new to Android testing with Appium , I am trying to open app in AVD the app getting installed but then m getting Error “A new Session could not be created.(Original error: Command failed: )”,”killed”:false,”code”:1,”signal”:null,”origValue”:”Command failed: “},”sessionId”:null}

Thanks for the help in advance

tried with just giving capabilities.setCapability(“appActivity”, “.MainActivity”);

'''



File classpathRoot = new File(System.getProperty("user.dir"));
        File appDir = new File(classpathRoot, "/Apps/src/");
        File app = new File(appDir, "ChatApp-release.apk");

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("deviceName", "emulator-5554");
        capabilities.setCapability("platformVersion", "7.1.1");
        capabilities.setCapability("platformName", "Android");
        capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage", "com.aaa.charla");
        capabilities.setCapability("appActivity", "com.aaa.xxx.MainActivity");

        driver = new AndroidDriver(new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
        driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
        Thread.sleep(10000);
        driver.quit();

Following are the Debug log:

info: Console LogLevel: debug info: –> POST /wd/hub/session {“desiredCapabilities”:{“app”:”D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk”,”appPackage”:”com.odysseyinc.charla”,”appActivity”:”com.odyssey.chatapp.MainActivity”,”newCommandTimeout”:”10000″,”platformName”:”Android”,”version”:”7.1.1″,”deviceName”:”emulator-5554″}} info: Client User-Agent string: Apache-HttpClient/4.5.2 (Java/1.8.0_162) info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version info: [debug] Using local app from desired caps: D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk info: [debug] Creating new appium session 0d25aeac-d055-449f-af84-b6d314d9b4a5 info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_162 info: [debug] Checking whether adb is present info: [debug] Using adb from C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe info: [debug] Set chromedriver binary as: C:Program Files (x86)Appiumnode_modulesappiumbuildchromedriverwindowschromedriver.exe info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Checking whether app is actually present info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices… info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe devices info: [debug] 1 device(s) connected info: Found device emulator-5554 info: [debug] Setting device id to emulator-5554 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 wait-for-device info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “echo ‘ready'” info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “getprop ro.build.version.sdk” info: [debug] Device is at API Level 25 info: Device API level is: 25 info: [debug] Extracting strings for language: default info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “getprop persist.sys.language” info: [debug] Current device persist.sys.language: info: [debug] java -jar “C:Program Files (x86)Appiumnode_modulesappiumnode_modulesappium-adbjarsappium_apk_tools.jar” “stringsFromApk” “D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk” “C:UsersUNMESH~1.GHAAppDataLocalTempcom.odysseyinc.charla” info: [debug] Reading strings from converted strings.json info: [debug] Setting language to default info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 push “C:UsersUNMESH~1.GHAAppDataLocalTempcom.odysseyinc.charlastrings.json” /data/local/tmp info: [debug] Checking whether aapt is present info: [debug] Using aapt from C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkbuild-tools28.0.3aapt.exe info: [debug] Retrieving process from manifest. info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkbuild-tools28.0.3aapt.exe dump xmltree D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk AndroidManifest.xml info: [debug] Set app process to: com.odysseyinc.charla info: [debug] Not uninstalling app since server not started with –full-reset info: [debug] Checking app cert for D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk. info: [debug] executing cmd: java -jar “C:Program Files (x86)Appiumnode_modulesappiumnode_modulesappium-adbjarsverify.jar” D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk info: [debug] App already signed. info: [debug] Zip-aligning D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk info: [debug] Checking whether zipalign is present info: [debug] Using zipalign from C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkbuild-tools28.0.3zipalign.exe info: [debug] Zip-aligning apk. info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkbuild-tools28.0.3zipalign.exe -f 4 D:AndroidNewYrreportYrReportRemoteSystemsTempFilesAppiumapkChatApp-master-0.9.35.1195-release.apk C:UsersUNMESH~1.GHAAppDataLocalTemp119427-15556-1rmbgw9appium.tmp info: [debug] MD5 for app is f3d7efc8b197792c3d0529a48dc92ff2 info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “ls /data/local/tmp/f3d7efc8b197792c3d0529a48dc92ff2.apk” info: [debug] Getting install status for com.odysseyinc.charla info: [debug] Getting device API level info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “getprop ro.build.version.sdk” info: [debug] Device is at API Level 25 info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “pm list packages -3 com.odysseyinc.charla” info: [debug] App is installed info: App is already installed, resetting app info: [debug] Running fast reset (stop and clear) info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “am force-stop com.odysseyinc.charla” info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 shell “pm clear com.odysseyinc.charla” info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device… info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 push “C:Program Files (x86)Appiumnode_modulesappiumbuildandroid_bootstrapAppiumBootstrap.jar” /data/local/tmp/ info: [debug] Pushing settings apk to device… info: [debug] executing cmd: C:Usersunmesh.ghatbandheAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5554 install “C:Program Files (x86)Appiumnode_modulesappiumbuildsettings_apksettings_apk-debug.apk” info: [debug] Stopping logcat capture info: [debug] Logcat terminated with code null, signal SIGTERM info: [debug] Sent shutdown command, waiting for UiAutomator to stop… warn: UiAutomator did not shut down fast enough, calling it gone error: Failed to start an Appium session, err was: Error: Command failed: adb: failed to install C:Program Files (x86)Appiumnode_modulesappiumbuildsettings_apksettings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]

info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session info: [debug] Error: Command failed: adb: failed to install C:Program Files (x86)Appiumnode_modulesappiumbuildsettings_apksettings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]

at ChildProcess.exithandler (child_process.js:637:15)
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: Command failed: adb: failed to install C:Program Files (x86)Appiumnode_modulesappiumbuildsettings_apksettings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]rn)”,”killed”:false,”code”:1,”signal”:null,”origValue”:”Command failed: adb: failed to install C:Program Files (x86)Appiumnode_modulesappiumbuildsettings_apksettings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]rn”},”sessionId”:null} info: <– POST /wd/hub/session 500 32039.992 ms – 664

`

Answer

I have upgraded the Appuim 1.4 to 1.9 and started working as Expected .