I've just created a new KMM project through out KMM Plugin, but I can't run or even debug in Xcode iosApp part of the project. When I try to run iosApp from Android Studio, the build process fails (Command PhaseScriptExecution failed with nonzero exit code)
The final lines of building was:
FAILURE: Build failed with an exception.
Compilation finished with errors
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 8s 1 actionable task: 1 executed Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
The following build commands failed: PhaseScriptExecution Run\ Script /Users/tamegajr/AndroidStudioProjects/TesteKMM5/build/ios/iosApp.build/Release-iphonesimulator/iosApp.build/Script-7555FFB5242A651A00829871.sh (1 failure)
Can anyone help to solve this problem?
In my case XCode's JAVA_HOME variable caused the problem.
Add this two lines into Build Script, before gradlew tasks. (I've used Android Studio's built-in JDK. If you want to use another JDK, you should change JAVA_HOME and JDK_HOME paths in code below.)
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home/
export JDK_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/
Your final Build Script should be like this;
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home/
export JDK_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/
cd "$SRCROOT/.."
./gradlew :shared:embedAndSignAppleFrameworkForXcode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With