Appium Error: Could not get Xcode version

2019-07-11 02:10发布

问题:

Appium error when trying to launch test on eclipse. I have installed Xcode 6.4 and it should work but it doesn't.

error: Could not determine Xcode version:Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.

info: [debug] Setting iOS SDK Version
info: [debug] Cleaning up appium session
info: [debug] Error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.
    at getVersionWithoutRetry$ (lib/xcode.js:115:11)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:294:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at bound (domain.js:254:14)
    at GeneratorFunctionPrototype.runBound (domain.js:267:12)
    at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:89:39)
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-xcode/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:100:28
    at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.)","origValue":"Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk."},"sessionId":null}
info: <-- POST /wd/hub/session 500 470.776 ms - 286 

error: Could not determine iOS SDK version
error: Failed to start an Appium session, err was: Error: Could not get Xcode version. /Library/Developer/Info.plist does not exist on disk.

Eclipse code

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

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class Uicatalog {
    public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities cap=new DesiredCapabilities();
        File f=new File("/Users/afiliptsov/Application to study/ui-catalog-app.zip");
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.4");
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 5s");
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability(MobileCapabilityType.APP, f.getAbsolutePath());
        IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
    }
}

回答1:

I was using command line Appium. To resolve the issue you have to switch Xcode to the proper path.

The following command will help:

sudo xcode-select --switch /Applications/Xcode.app

If you have installed Xcode app in a different location, give that path instead of /Applications/Xcode.app.



回答2:

Had the same issue, the problem was that the path to XCode was in Appium was set to something like "xcode/library/developer/commandlinetools". Setting the correct path to Xcode (in my case: "MacintoshHD/Applications/Xcode 2") in the advanced iOS Settings solved the problem for me.(Xcode 7, Appium 1.4.13)



回答3:

First i reset it using sudo xcode-select --reset

and then used sudo xcode-select --switch /Applications/Xcode.app

Note: just make sure you set correct path to Xcode (Application->Xcode)



回答4:

Maybe you are using Xcode version 10 and It is not support appium because appium server problem, you can back to Xcode ver 9. or use appium beta:

npm uninstall -g appium && npm install -g appium@beta


回答5:

Best way to resolve this is to move the Xcode application into your Applications folder on mac machine.



回答6:

Xcode 10.1

Check whether Command Line Tools of respective Xcode Version are installed or enabled