I am working on a multiplatform app in Kotlin on Android Studio and when I try to run the app to an iOS simulator, I get this error:
The following build commands failed:
PhaseScriptExecution [CP-User]\ Build\ shared /Users/cjm/AndroidStudioProjects/GlobeMultiplatform/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-882AF45D8B8C4938AC461F4FBA0FE197.sh (in target 'shared' from project 'Pods')
The code in the build.gradle
that sets the cocoa pods is this:
cocoapods {
summary = "Shared"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "13"
frameworkName = "shared"
podfile = project.file("../iosApp/Podfile")
}
I ran pod install and it showed success but the build of the app still fails. How can I fix this error? What is causing this error? I am brand new to Kotlin and especially Kotlin Multiplatform so I apologize if this is a stupid question.
EDIT: Here's what Xcode says when running the app:
FAILURE: Build failed with an exception.
Where: Build file '/Users/cjm/AndroidStudioProjects/GlobeMultiplatform/androidApp/build.gradle.kts' line: 1
What went wrong: An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing
org.gradle.java.home
ingradle.properties
.
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
PhaseScriptExecution [CP-User]\ Build\...
line – Crowberry1.8.20
– Skep