Katalon Studio Close Application Doesn't Work

I’m using Katalon Studio to test a mobile application. When I use Start Existing Application, the Close Application method doesn’t work. Example from my project of something that doesn’t work.


import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

//Start the app and then get to the login page
Mobile.tap(findTestObject(‘Object Repository/Application/Login/android.widget.Button - ACKNOWLEDGE’), 2, FailureHandling.OPTIONAL)
Mobile.tap(findTestObject(‘Application/Login/android.widget.Button - LOGIN’), 2, FailureHandling.OPTIONAL)
// Input a correct username and wrong password
Mobile.setText(findTestObject(‘Application/Login/Username’), ‘fakeUsername’, 0)
Mobile.setText(findTestObject(‘Application/Login/Password’), ‘Wrong Password’, 0)
// Tap the middle of the login button. If you do a standard click it doesn’t work because it clicks outside the rounded edge
// Mobile.tapAtPosition(720, 2258)
String failureMessage = Mobile.getText(findTestObject(‘Object Repository/Application/Login/android.view.View - Unable to sign in’), 0)
assert failureMessage.equalsIgnoreCase(‘Unable to sign in’)

I have tested this and confirmed that it works when I start the application by installing the .apk from the Katalon project, but because of the way that our application needs to authenticate, we have to start it from the phone. I understand that I can get around this issue for most of my tests by logging out and relogging in, and that I don’t want to have to start and close the app between every test because that would be unnecessary and slow. That said, I think this is something that should be fixed because it’s a pretty important part of the core Katalon mobile testing.