java.lang.RuntimeException: java.lang.InstantiationException: On initializing AndroidDriver

Hi All,
Iam getting following error while running following script as seen below

iam using POM for the project where i have created 2 class one class contains pagefactory elements and other includes test cases. but iam getting Instantiation exception over the initialization of the android driver as seen below

public class HomePageFactory
{

private AndroidDriver  driver

public HomePageFactory(AndroidDriver driver)
{
	this.driver = driver;	
}
public void swipeDirection()
{    

//swipe operation
}}

Test Cases Class:
public class VerifyHomePageTC
{
private AndroidDriver driver;
@Test
public void VerifyHomePageSwipeAndSideMenuOpen() throws MalformedURLException, InterruptedException
{

	HomePageFactory home = PageFactory.initElements(driver, HomePageFactory.class);
	Thread.sleep(3000);
	home.swipeDirection();
}

}

when i run the TC, iam getting following error
java.lang.RuntimeException: java.lang.InstantiationException: Testpages.HomePageFactory

Can any one help me out with your answer to resolve this issue… Appreciate for your valuable replay
Thanks

Maybe it’s a typo when missing the “;” ?

Hi TuHuynh…
Thanks for your replay…
iam not sure about is because of ‘typo’… i found in below example page to extends AbstractPageObject class https://github.com/appium/java-client/issues/73
but in the POM as i mentioned, iam not using abstract class… and whenever i initialize the android driver, iam getting the null pointer exception as the initialisation taken null value by default…

Would be great if you can give me the right way to define the same in order to fix the issue…
Thanks

Please give a try with:

In the @Test, please change:
AndroidDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:YourAppiumPortHere/wd/hub”), capabilities);

Then use that driver to interact among classes.

You don’t need this: private AndroidDriver driver; when using above command.