Encountered internal error running command: Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was ex | Appium Forum
M
Manikandan Eswaran Posted on 04/12/2020

Error from Appium server log;

Followed all the setup as per video, but i see this error

Encountered internal error running command: Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported.


A
Ashish Replied on 04/12/2020

Which OS do you have?


M
Manikandan Eswaran Replied on 04/12/2020

Windows 8 


M
Manikandan Eswaran Replied on 04/12/2020

Now working fine , update the below appium config. I hope this is the correct.

Responsive image


M
Manikandan Eswaran Replied on 05/12/2020

I am still facing the issue when appium server is trying to start from java programatically and windows cli. 

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details

 

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

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;

public class applaunch {

public static void main(String[] args) {
// TODO Auto-generated method stub

DesiredCapabilities deCap = new DesiredCapabilities();
deCap.setCapability(MobileCapabilityType.DEVICE_NAME,"yxgevwh68pn7gijb");
deCap.setCapability(MobileCapabilityType.UDID,"yxgevwh68pn7gijb");
deCap.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
deCap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10");
// deCap.setCapability(MobileCapabilityType.APP,new File(makeMyTrip).getAbsolutePath());
deCap.setCapability("appPackage", "com.makemytrip");
deCap.setCapability("appActivity", "com.mmt.travel.app.home.ui.SplashActivity");
deCap.setCapability(MobileCapabilityType.NO_RESET,"true");//don't clear the cache
deCap.setCapability(MobileCapabilityType.FULL_RESET, "false");//don't re-install the app


// start appium server programtically

AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.withIPAddress("0.0.0.0");
builder.usingPort(4723);
builder.withLogFile(new File("classpath://appiumLog.txt"));
// builder.withCapabilities(deCap);
builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
builder.withArgument(GeneralServerFlag.LOG_LEVEL,"debug");

AppiumDriverLocalService service = AppiumDriverLocalService.buildService(builder);
service.start();


try {
AndroidDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"),deCap);

Thread.sleep(5000);
driver.quit();

} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

service.stop();

}
}

 

How to step above config, shown in screen shot, using cli and java program 


Related Posts