UnreachableBrowserException

I had my Appium working perfectly for past few months but suddenly I started getting this exception. The appium server Doesn’t produce any logs (as it is never found). I have checked with different ports as well but no luck. Here are the capabilities I use:

	File appDir = new File("/Users/abc/Downloads/");
		File app = new File(appDir, "abc.apk"); // 
		DesiredCapabilities caps = new DesiredCapabilities();
		caps.setCapability("full-reset", true);
		caps.setCapability("platformName", "Android");
		caps.setCapability("deviceName", serverDetails[0]); 

		caps.setCapability("app", app.getAbsolutePath());
		caps.setCapability("appPackage", "com.abc.ABC");
		// *******enable these******
		caps.setCapability("resetKeyboard", true);
		caps.setCapability("unicodeKeyboard", true);
		caps.setCapability("autoGrantPermissions", "true");

I have tried version 1.5.3, 1.6.4, 1.6.5

serverDetails[0]

how you are getting this value? Quite possible this value is null or does not have expected value. Try with exact value in string format and then try to fix the logic.

I’m fetching this from a property file. I checked I’m getting the right value and also tried by hard coding it but no luck. Thanks

Execute the below command with connecting to the android device, then if it not launches the app ask developers to enable following permission “android:export = true” on main activity and get the build.

adb -s <<device_id>> shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n <<app_package>>/<<app_activity>>”

eg:
adb -s 4100fd5a18d17000 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.testpackage/com.test.activity”

or please check the apk file path you have mentioned is correct.

Thanks Thangaraj, Can you please explain what is the intent of executing the above command? The apk path I’m using is correct and there is no change made to this code for past few months(And this was running fine till now). Also, when I try to launch the application through Appium desktop, it works fine. The only problem is I’m, unable to find the appium server through Java. It is Unreachable. Hope that gives you more insight for finding a solution.

if you ping the appium server would it be pinged successfully.

0.0.0.0 can’t be pinged. ‘ping 0.0.0.0’ is the statement pointing to a default gateway. The server exists locally and is reachable as the Appium desktop finds it all the time.