============== ROOT CAUSE =====================
Caused by: java.lang.NullPointerException: inputStream
For trouble shooting, please visit: Troubleshoot common exceptions | Katalon Docs
================================================
07-12-2025 09:17:25 pm Test Cases/Verify Correct Alarm Message
Elapsed time: 0.629s
Test Cases/Verify Correct Alarm Message FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to start application: ‘C:\Users\samar\Katalon Studio\sample 1\androidapp\APIDemos.apk’
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:65)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:34)
at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.startApplication(StartApplicationKeyword.groovy:91)
at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.execute(StartApplicationKeyword.groovy:48)
at
You get a “NullPointerException” when the definition and contents of a variable, or Test Object, does not exist. Can you show us your code around the variable: “inputStream”? For instance, if I have only have the statement:
WebUI.comment("What is it all about ${inputStream})"
without defining and initializing the variable, inputStream, we will get a “NullPointerException”. However, if we have as a single statement like:
def inputStream = "...some value..."
WebUI.comment("What is it all about ${inputStream})"
or, as a couple of statements, like:
def inputStream = null
inputStream = "...some value..."
WebUI.comment("What is it all about ${inputStream})"
Then, “inputStream” is defined, and initialized, and you will NOT get an exception. So, again, show us your code around the variable, “inputStream”, and maybe we can spot something.
kindly format the code blocks with ``` `for better readability
Caused by: java.lang.NullPointerException: inputStream
For trouble shooting, please visit: Troubleshoot common exceptions | Katalon Docs
================================================
07-12-2025 09:17:25 pm Test Cases/Verify Correct Alarm Message
Elapsed time: 0.629s
Test Cases/Verify Correct Alarm Message FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to start application: ‘C:\Users\samar\Katalon Studio\sample 1\androidapp\APIDemos.apk’
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:65)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:34)
at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.startApplication(StartApplicationKeyword.groovy:91)
at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.execute(StartApplicationKeyword.groovy:48)
at
The NullPointerException: inputStream error occurs when Katalon can’t access the APK file.
Immediate Fixes:
- Fix APK Path Handling:
groovy
// Use forward slashes
String appPath = "C:/Users/samar/Katalon Studio/sample 1/androidapp/APIDemos.apk"
// Or escape backslashes
String appPath = "C:\\\\Users\\\\samar\\\\Katalon Studio\\\\sample 1\\\\androidapp\\\\APIDemos.apk"
- Verify File Exists:
Add this check before starting the app:
groovy
import java.nio.file.*
String appPath = "C:/Users/samar/Katalon Studio/sample 1/androidapp/APIDemos.apk"
Path apkPath = Paths.get(appPath)
if (!Files.exists(apkPath)) {
throw new Exception("APK not found at: " + appPath)
}
Mobile.startApplication(appPath, false)
- Reinstall APK via ADB:
- Connect device
- Run in CMD:
text
adb uninstall io.appium.android.apis
adb install "C:\Users\samar\Katalon Studio\sample 1\androidapp\APIDemos.apk"
Critical Checks:
- File Corruption:
- Re-download the APK file
- Verify MD5 checksum (original vs your copy)
- Path with Spaces:
Move project to a space-free path:
text
- C:\Users\samar\Katalon Studio\sample 1\
+ C:\Katalon_Projects\sample1\
- Katalon Configuration:
Go to Project Settings > Execution > Default Mobile:
- Set “Start application with” to Path relative to project
- Move APK to
Include folder
- Use in script:
groovy
String appPath = RunConfiguration.getProjectDir() + "/Include/APIDemos.apk"
ADB-Specific Fixes:
- Kill ADB Server:
text
adb kill-server
adb start-server
adb devices
- Check Device Authorization:
- Revoke USB debugging authorizations on device
- Reconnect device and “Always allow” prompt
Alternative Approach:
Use package name instead of APK path:
groovy
Mobile.startApplication('io.appium.android.apis', false)
If Issue Persists:
- Create new test case with only:
groovy
String appPath = "C:/path/to/your.apk" // Use corrected path
Mobile.startApplication(appPath, true)
- Run in debug mode (right-click → Debug)
- Check “Console” tab for detailed errors
it is a default file for – sample test for mobile in katalon studio
still got this error
Hi @grylion54,
Can you help @samarthpatil450 more on this? Appreciate your help