openbakery / gradle-xcodePlugin

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

Plugin breaks when installed with Android Gradle Plugin Alpha-07 / Android Studio Canary 7 #444

Open chris-hatton opened 3 years ago

chris-hatton commented 3 years ago

After upgrading Android Studio from 2020.3.1 Canary 6 to Canary 7, the Xcode plugin 'broke' - with IDE Gradle Sync failing on an OkHttp API that is incompatible with Kotlin Companion objects.

Ultimately this appears to be because the version of OkHttp used by the Xcode plugin is too old. I was able to work around this by replacing the dependency with a later OkHttp3 based one (and was lucky enough that the API is still compatible), here:

In top-level build.gradle:

buildscript {
    repositories { ... }
    dependencies { ... }
    configurations.all {
        resolutionStrategy.eachDependency {
            if (requested.group == "com.squareup.okhttp" && requested.name == "okhttp") {
                useTarget("com.squareup.okhttp3:okhttp:4.9.1")
            }
        }
    }
}

This workaround may help similarly affected users. Suggest the Xcode plugin project updates the dependency.