“driver cannot be resolved” I am new to Java AND programming. Can you please help me?

I am very new to programming. My main goal is to write code that logs into a android app and does everything that you would have to do with your fingers. So far I’ve only got the app to open, now i’m stuck on entering the login information. I am not familiar with every aspect that has to do with java, eclipse, appium, automation, and selenium, so any help would be greatly appreciated.

Here is my code -

package OpenOfferUpTest;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;

public class OpenOfferUp {

public void OpensOfferUp() throws MalformedURLException
File OfferUp = new File("C:\\Users\\boung\\Desktop\\OfferUp.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "Virtual Device");
cap.setCapability("platformName", "android");
cap.setCapability("null", "OfferUp");
cap.setCapability("appPackage", "com.offerup");
cap.setCapability("appActivity", "com.offerup.android.login.splash.LoginSplashActivity");

AndroidDriver driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), cap);

public void SimpleTest() {



At driver, it is underlined red, and says that it cannot be resolved. I am not sure on how to fix this.

These are the options I am given -

REMEMBER I am completely new to this, and if you have an answer, I am asking that you describe in detail what the problem is so I know how to fix it next time. If you could actually show me what to do and not just tell me, i’d greatly appreciate it. Thank you.

The ‘driver’ variable is out of scope. Read this for more info:

Since you are so new to this, have you thought about following a tutorial? There are plenty out there, this one looks good:


You just need to initiate the driver before using it

public class OpenOfferUp {

public static AppiumDriver driver;

public void OpensOfferUp() throws MalformedURLException