Here is my Java code:

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

  public class AppiumCapabilities {
  @Test
  public void testAppium() throws MalformedURLException{
  AndroidDriver driver;
  DesiredCapabilities capability = new DesiredCapabilities();
  capability.setCapability("platformName", "Android");
  capability.setCapability("deviceName", "Nexus 5");
  capability.setCapability("udid","039e8ae813aa787d");
  capability.setCapability("platformVersion", "6.0.1");
  File file = new File("C:\\Users\\ShahreenMushtaq\\workspace1\\Appium\\zameenapk\\app-zameen- 
  live-release.apk");
  capability.setCapability("app", file.getAbsolutePath());
  driver = new AndroidDriver(new URL("http://192.168.100.12:4723/wd/hub"),capability);
  }
 }

Error:

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: platformName, deviceName)","origValue":"The following desired capabilities are required, but were not provided: platformName, deviceName"},"sessionId":null} info: <-- POST /wd/hub/session 500 3.228 ms - 314

I have already restarted the Appium with Override Existing Session. My Appium settings are shown below:

Appium Settings

0

There are 0 answers