Closed vladimirpetrovski closed 4 years ago
Kotlin/Multipaltform libraries use Gradle metadata to solve the proper target. Gradle metadata is available from Gradle version 5.3 if enabled explicitly in settings.gradle
(or settings.gradle.kts
) with enableFeaturePreview("GRADLE_METADATA")
and enabled by default from Gradle 6 and onward.
I really suggest to keep Gradle updated as much as possible to overcome compatibility issues. Keep track of Gradle releases from https://gradle.org/releases/
I still have the same problem, even though I am using enableFeaturePreview("GRADLE_METADATA")
all the time. The Gradle version I am trying to make it work is 5.6.4.
Thanks for the suggestion but I'm afraid I won't be able to update it furthermore as other libraries I'm already using aren't yet compatible with the latest versions of Gradle.
Update: I tried using Gradle 6.4.1 just to make sure if the version is the problem, but the problem remains.
Could you share the build file?
Thank you for looking into it! Here is the build.gradle.kts file.
I've found a similar issue in this library. Do you think publishing a new debug variant will solve the problem?
The build script seems fine. I just double checked the build file of the 1.8
publication and seems fine as well. I've built the library with Kotlin 1.3.61, it may be the problem, I'll try to republish with 1.4 and 1.3.72 as soon as I have a little time! What version of Kotlin are you using?
I'm using Kotlin version 1.3.71. I've tried using 1.3.61, but nothing has changed.
I just created a new project with Kotlin 1.3.72 and Gradle 6.5 and managed to import the library correctly. Try deleting the .gradle
folder in your user home and in the project root directory and restart IntelliJ. Try keeping Gradle 6.5 a run a Gradle sync.
Also, the library is still in early dev. I've used Auth in common code when compiling for Android only and it was working. Never tried other platforms.
I'd recommend you to fork and clone the library locally and go for a composite build and use this in your settings.gradle.kts
:
val firebaseMultipaltformPath = "../firebase-multiplatform"
if (file(firebaseMultipaltformPath).run { exists() and isDirectory })
includeBuild(firebaseMultipaltformPath){
dependencySubstitution {
listOf("auth", "core").forEach {
substitute(module("com.github.lamba92:firebase-multiplatform-$it")).with(project(":$it"))
}
}
}
IntelliJ should show you the project sources in the project UI and let's you navigate them even from your project. Note that the actual master uses Kotlin 1.4-M2 and Android Gradle Plugin 3.5.3 and Gradle 6.5. This meas that you should either downgrade firebase-multiplatform
to Kotlin 1.3.72 or upgrade your project to Kotlin 1.4.M2, otherwise you will encounter strange errors due to incompatibilities between K/Native compilations. Also check the build script classpath for the Android Gradle Plugin version conflicts.
I was not able to build the latest sources due to changes in the Firebase iOS Framework updates and not having a macOS available to develop on (using Windows atm).
Let me know if composite build works and if you find and fix any bug feel free to ask a PR! I'd be glad to merge it.
I did manage to build the project without any error using your instructions above, but the files from the dependencies still can not be resolved in the commonMain
module. I guess there are too many incompatibilities between versions and I'm not able to find a decent solution. Anyway, thank you for your assistance! If I manage to find a solution I'll let you know.
If you can share your build files I can help
Here are all Gradle files from my project initially before all these modifications. The gradle version I'm using in the project is 5.6.4.
@lamba92 Thank you for your help, but I'll continue with the TeamHub project I've just found and I'm not going to need your help anymore. Looks well prepared and works out of the box.
oh well, i was not aware that there was an official K/MPP lib!
Thank you for creating these libraries, but still, I am not able to include them in my project. I am having difficulties including the
core
andauth
libs in my common main module as am getting some variant error.Anyway, I am not using any flavours in the android project. The Gradle version is 5.6.4.
What could be the problem here and please feel free to ask me for more info on it?
Thank you in advance for your help!
Here is the error: