openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
457 stars 127 forks source link

java.io.IOException: Cannot run program "/Contents/Developer/usr/bin/simctl" (in directory "."): error=2, No such file or directory #397

Closed varris closed 5 years ago

varris commented 5 years ago

I have build.gradle

buildscript { repositories { maven { url('http://repository.openbakery.org') } mavenCentral() }

dependencies {
    classpath "org.openbakery:xcode-plugin:0.15.+"
}

}

apply plugin: 'org.openbakery.xcode-plugin'

xcodebuild { target = 'dev-ios' scheme = 'dev-ios' // configuration = 'Test' destination = ['iPhone 8' ] }

after ./gradlew -p dev-ios/ build have error FAILURE: Build failed with an exception.

I have xcode 10, gradle 4.7

renep commented 5 years ago

The command for simctl should be: /Application/Xcode.app/Contents/Developer/usr/bin/simctl

The Xcode path is determined using the following command: xcode-select -p Could you please run the command and see what your output is. This should be: /Applications/Xcode.app/Contents/Developer

You can also do this with the build.gradle by adding:

task checkSimctl {
  doLast {
    def commandRunner = new org.openbakery.CommandRunner()
    println new org.openbakery.xcode.Xcode(commandRunner).getSimctl()
  }
}

and then execute: ./gradlew checkSimctl

My guess is that something is wrong with the xcode installation, or the command line tools.

varris commented 5 years ago

Hello,

I did that and got ./gradlew -p dev-ios/ checkSimctl

Task :dev-ios:checkSimctl /Contents/Developer/usr/bin/simctl

BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed

and I have for sure simctl l /Applications/Xcode.app/Contents/Developer/usr/bin/simctl -rwxr-xr-x 1 root wheel 294B Aug 22 14:26 /Applications/Xcode.app/Contents/Developer/usr/bin/simctl

and it is xcode 10

run xcode-select -p /Applications/Xcode.app/Contents/Developer

varris commented 5 years ago

closing because after updating to xcode 10 need update command line tools to xcode 10

varris commented 5 years ago

don't forget update command line tools

varris commented 5 years ago

I was wrong still have the problem

varris commented 5 years ago

the problem is gradle 4.7 when I have changed your repo to 4.7

got the same error with example build

./gradlew -p example/tvOS/Example_tvOS_Swift/ build

Task :xcodebuild FAILED

FAILURE: Build failed with an exception.

renep commented 5 years ago

can you run xcode-select -p

varris commented 5 years ago

xcode-select -p /Applications/Xcode.app/Contents/Developer

varris commented 5 years ago

the problem is gradle. if have gradle >= 4.7 it will run gradle daemon for speeding up the build. sometimes that daemon caches wrong path value.

the workaround is run gradle with no daemon option ./gradlew --no-daemon -p dev-ios/ test