Nishita
Nishita

Reputation: 924

Gradle project sync failed, Cause: org/gradle/api/internal/FeaturePreviews

I am trying to follow the following tutorial: https://github.com/JetBrains/kotlin-native/blob/master/MULTIPLATFORM.md

But when I try to build the android app from android studio, I get the following error:

FAILURE: Build failed with an exception.

  • Where: Build file '/Users/nishita.dutta/AndroidStudioProjects/KotlinMultiplatform/application/greeting/ios/build.gradle' line: 1
  • What went wrong: A problem occurred evaluating project ':application:greeting:ios'. org/gradle/api/internal/FeaturePreviews

This is my ios/build.gradle file

apply plugin: 'konan'

// Specify targets to build the framework: iOS and iOS simulator
konan.targets = ['ios_arm64', 'ios_x64']

konanArtifacts {
// Declare building into a framework.
framework('Greeting') {
    // The multiplatform support is disabled by default.
    enableMultiplatform true
}
}

dependencies {
// Specify dependency on a common project for Kotlin multiplatform build
expectedBy project(':greeting:common')
}

Upvotes: 2

Views: 2278

Answers (1)

Dave Leeds
Dave Leeds

Reputation: 698

Make sure you're using Gradle version 4.7 or higher. If you're using the Gradle wrapper, you can update it from the command line.

To do that, first comment out your entire ios/build.gradle file (to prevent it from causing problems when updating the wrapper version). Then, run this at the command line:

./gradlew wrapper --gradle-version 4.7

Finally, uncomment your ios/build.gradle file again and build the project.

Upvotes: 1

Related Questions