Trying to setup cocoapods for my Kotlin MPP:
plugins {
kotlin("multiplatform") version "1.5.10"
kotlin("native.cocoapods") version "1.5.10"
id("com.android.library")
id("maven-publish")
}
Syncing the project ends up in this error:
Execution failed for task ':podspec'.
> this and base files have different roots: C:\Users\user\AppData\Local\Temp\wrap6957loc\gradlew and G:\Workspace\tracking-lib.
I am on windows and always will be. The project should build on Windows and Mac. So I assume basic inclusion of that plugin should work?
What can I do to fix the paths?
This looks like a bug. The plugin should be disabled, but the build should be working fine. Please consider reporting it to https://kotl.in/issue The cocoapods plugin strongly relies on pre-installed components, such as Xcode CLI Tools, cocoapods and cocoapods-generate. All of them are described here. The iOS targets of the Kotlin MPP project themselves can't be built on Windows, this is a restriction of the compiler. See a full list of targets and their availability here.
Related
I have an existing project using Gradle 5.6.3, which is currently building Java-only Android. I'd like to add a library in Kotlin.
I had IntelliJ generate a library module, which gave me the following configuration:
plugins {
id 'org.jetbrains.kotlin.android'
}
and in my parent project
buildscript {
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30'
}
}
However, when I run this, it fails, saying The current Gradle version 5.6.3 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin.
Because of reasons, upgrading Gradle is not an option for the project right now. So I want to satisfy Gradle by using "the previous version".
I already looked at the compatibility matrix, but that only says that Gradle is tested with Kotlin 1.3.72 through 1.6.0., which isn't helpful.
So, which version of the kotlin-gradle-plugin do I need if I want to stay on Gradle 5.6.3?
Setup
I setup a Gradle multi-project project, including the Kotlin DSL as described on in the Gradle documentation. My Gradle version is 7.4.1, which is the recent version at the time of writing.
In this part of the documentation we are told to use convention plugins for subproject configuration and we should not use subprojects or allprojects DSL.
That is the reason I ended up having
plugins {
`kotlin-dsl`
}
in my buildSrc/build.gradle.kts, which is all working as expected.
Problem
By using kotlin-dsl I'm wired to gradle-kotlin-dsl-7.4.1.jar (Gradle version, I mentioned earlier). This jar seems to specify all Kotlin related versions along the project; i.e. I cannot do this to specify my Kotlin version
plugins {
`kotlin-dsl`
kotlin("jvm") version "1.6.10"
// ...
}
Because two different Kotlin versions will appear
$ ./gradlew build
> Configure project :buildSrc
WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.5.31` that might work differently than in the requested version `1.6.10`.
That behaviour and the warning are described here.
Questions
Am I able to use a more recent version of Kotlin in this setup, if so: how?
Out of curiosity: where do I see the Kotlin version tracked, that is baked into Gradle? I could not find any notice in the last hand full of release notes
atm there is no way to update the embedded version of the Kotlin the kotlin-dsl plugin relies on (github.com/gradle/gradle/issues/16345)
I think your best bet would be the gradle github
(github.com/gradle/gradle/issues/19308)
I am making a desktop app using Kotlin compose(IntelliJ version 2021.2.1). My project is still running but I am getting these compile errors in the kotlin compose code.
"Check your module classpath for missing or conflicting dependencies"
Here are my project configurations
As a solution, I removed cashe in .gradle and restart IDE with invalidating cashe but didn't work. and changed JDK versions and kotlin versions as well but still getting the same output.
Your project uses pretty outdated versions of both kotlin and Compose.
Check out that your Compose Multiplatform IDE Support plugin is up to date, the latest version for today is 1.0.0-alpha4-build331
Latest versions of plugins for build.gradle.kts:
kotlin("jvm") version "1.5.21"
id("org.jetbrains.compose") version "1.0.0-alpha3"
Can't build react native app in android studio.
I tried:
Sync Project with Gradle Files, but I can't do it because of an
error
File -> Invalidate Caches/ Restart
Clear cache from $HOME/.gradle
Delete $HOME/.gradle
Change com.android.tools.build:gradle version on 2.3.0, because it's
the latest version in this list
(https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/build/gradle/), but when I use npx react-native init projectName, used Android Plugin Version 4.1.2, but this version there isn't in this list.
Also know the difference between Gradle, Android Gradle Plugin,
Gradle Wrapper, already read https://developer.android.google.cn/studio/releases/gradle-plugin?hl=en. I tryied to use the latest Gradle v. 6.8.2 and Android Gradle Plugin v. 4.1.2, it also didn't help to build the project.
Change distributionUrl in
projectName/android/gradle/wrapper/gradle-wrapper.properties
Change in File->Settings->Build, Execution, Deployment->Gradle use
Gradle from Specified location and set C:/Gradle/gradle-6.8.2, it didn't help and left it at default
I know there are exactly the same questions on stackoverflow and on github, but the solutions haven't helped.
Build output:
Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-settings
Add google Maven repository and sync project
Open File
Now used:
Gradle v. 6.5
Android Gradle Plugin v. 4.1.2
gradle-wrapper 6.5-all
Android Studios 4.1.2
Android SDK Platform: Android 10, 9, 8.1, 8.0, 7.1.1, 7.0
Your google Maven library is missing. Rebuild project after adding it
Problem
after switching to androidX
with a multi-module Android library
using IntelliJ 2018.3.4 #IC-183.5429.30
using Robolectric 4.1 with android gradle plugin 3.3.1
when executing Robolectric tests, I receive:
java.lang.NoClassDefFoundError: androidx/test/runner/MonitoringInstrumentation
No duplicate question:
I read the other topics which pop up when using google or stackoverflow search but they are about a more specific error which is worked-around via adding specific dependencies. In my case I was not able to determine which dependency to add.
I add dependencies to androidx.test:core
for the build type under test.
In my case it was debug so in the build.gradle I add
debugImplementation 'androidx.test:core:1.2.0'
I read that no workaround should be required with Android Studio 3.3 and Robolectric 4.0.
Use Android Studio 3.3.1+ with Robolectric 4.0+
This works for me.