Groovy:unable to resolve class

Hi.

I have reviewed all the forum posts on this error but none seem to work for me.

I have a test case called which imports the standard Katalon built-in libraries.
This test case calls a keyword which itself also imports the standard Katalon built-in libraries.
However, when I run it, I receive this error.

2021-07-10 06:26:05.651 DEBUG testcase.Set_Vanilla_Database            - 9: Result = gVar.Set_SUA_Database.Set_SUA_DB(crBatPath, upBatPath, DeployPath, UpgradePath)
2021-07-10 06:26:05.667 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - ❌ Unresolved compilation problems: 
	Groovy:unable to resolve class MobileBuiltInKeywords
	Groovy:unable to resolve class WSBuiltInKeywords
	Groovy:unable to resolve class WebUiBuiltInKeywords
	Groovy:unable to resolve class MobileBuiltInKeywords
	Groovy:unable to resolve class WSBuiltInKeywords
	Groovy:unable to resolve class WebUiBuiltInKeywords
	Groovy:unable to resolve class MobileBuiltInKeywords
	Groovy:unable to resolve class WSBuiltInKeywords
	Groovy:unable to resolve class WebUiBuiltInKeywords
	Groovy:unable to resolve class MobileBuiltInKeywords
	Groovy:unable to resolve class WSBuiltInKeywords
	Groovy:unable to resolve class WebUiBuiltInKeywords

Whats strange is that, once again, both the test case and the keyword which it calls import the same standard Katalon libraries. Yet, the keyword gives the error.

I have tried deleting bin, Libs, .classpath, and .project, and then reopening my project. But it doesn’t help.

Also, the “Problems” tab generates similar errors for every Keyword I have, but no test cases.

Clearly, the libraries are not being compiled. But I do not know how to debug this issue. Help is appreciated.

Ilya

Please show the source code of your test case. Especially, the import statements.

Here is my import statements for libraries…

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 com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
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.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.concurrent.TimeUnit;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.lang.ProcessBuilder
import java.lang.Process

It happens the moment I click Run.

You have these 2 lines.

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

By these lines,

com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords

is aliased to be Mobile.

Therefore you got the error:

	Groovy:unable to resolve class MobileBuiltInKeywords

How to fix?

If you want to refer the class by MobielBuiltinKeywords, then you should delete the line of

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

while you want to retain the line of

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltinKeywords

If you want to refer to the class as “Mobile”, edit the code in the opposite way.

3 Likes

In you source code, you have so many import statements.
I guess that many of them are not used.
Unused import statements will make your code hard to read and error prone.
You should remove unused import statements by Ctrl+Shift+O.

1 Like

As always, thank you for your rapid and complete solution.
I was irresponsible in my use of libraries.

That hot key is a game changer