Is there something special that needs to be done w...
# multiplatform
k
Is there something special that needs to be done when running Gradle
dependencies
task on a KMP module with JVM, Android and iOS targets? Getting this error
Copy code
* What went wrong:
Failed to apply plugin 'com.android.internal.library'.
> Accessing GradleBuildProject.Builder through AnalyticsConfiguratorService is not allowed after AnalyticsService is created.
Seems to work just fine on non-KMP pure Android modules 🤔
j
I don't have a problem running this Gradle task in my KMP project, which includes those targets. Can you share your build script? What version of the Android Gradle plugin are you using?
a
In this case, it's essential to ensure that you have correctly configured the Android module in Android Studio and the iOS module in XCode. Once those configurations are in place, focus on configuring the shared module. Also, consider checking your Gradle setup, specifically for the KMP module with JVM, Android, and iOS targets. The error you encountered might be related to a specific Gradle plugin or configuration conflict.
Following link help me a lot, for setting up a KMM project https://gist.github.com/philipplackner/417590f35c65f07e897d95b7b76499a3
k
In this case, it’s essential to ensure that you have correctly configured the Android module in Android Studio and the iOS module in XCode. Once those configurations are in place, focus on configuring the shared module.
What do you mean by configuring modules in Android Studio and Xcode? Why would IDEs matter here? 🤔
For some context, we’ve had our KMP setup for about a year now and it’s been largely working pretty well, but just noticing that
dependencies
task isn’t working. Maybe something is indeed misconfigured on our side…
I also found this issue so wondering if it’s an AGP issue https://issuetracker.google.com/issues/286859043
a
I apologize for the misunderstanding. In this situation, please verify the compatibility of the Compose compiler in the Android module, the Java version used in the shared module's build.gradle, and also ensure that the AGP version is appropriately mapped with them. Additionally, I encountered a mapping issue with the KSP plugin version range in my case.
k
This turns out to be an AGP issue, not KMP https://issuetracker.google.com/issues/278767328
243 Views