Exception in thread "main" java.lang.NoClassDefFoundError (Java, Appium, Android Studio)

  android-studio, appium-android, java, windows

I keep getting an error on runtime when I’m executing from Eclipse IDE. I added the class paths for the commons-lang3, java-client and selenium webdriver for java jar packages. What am I missing?

My code:

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class InstallAppAndroidEmulator {

    public static void main(String[] args) {

        DesiredCapabilities dc = new DesiredCapabilities();

        dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
        dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, 9.0);
        dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
        dc.setCapability(MobileCapabilityType.APP, "C:UsersSome_NameDesktopapk filesapp-test.apk");

        URL url = null;
        try {
            url = new URL("http://localhost:4723/wd/hub");
            AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(url, dc);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}

Files:
enter image description here

Error message:
enter image description here

Source: Windows Questions

LEAVE A COMMENT