Kotlin MPP pod integration fails - kotlin

I just released a first version of my Kotlin MPP as a library 3 days ago. It was integrated on Android and iOS successfully.
After the first released I switched to a coworkers branch and invalidated my caches. Since then I am not able to sync gradle anymore.
I'm getting this error:
Task :cinteropSnowplowTrackerIosArm64
Exception in thread "main" java.lang.Error: /var/folders/gv/rc4dmzjs3wj9kt4kr00nwhdw0000gn/T/13496315139908854548.m:1:9: fatal error: could not build module 'SnowplowTracker'
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:68)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:14)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:515)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:266)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:76)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:38)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:60)
Even after going back to my very first POC commits, which was successfully published several times I am not able to build anymore.
Here is how I integrated the iOS dependency.
I don't have any idea what the issue is. I tried setting a whole bunch of different JDK versions (8, 11, 14, 15, 16, 17) without success. I tried upgrading Kotlin version from 1.4.20 to 1.5.x. I tried downgrading IntelliJ IDEA and many more things all without success. The only guess I have right now is that it is related to some plugin updated. How could I verify that?
Here is how the pod is integrated:
cocoapods {
ios.deploymentTarget = "12"
summary = "Kaia tracking library"
homepage = "https://github.com/KaiaHealth/kaia-tracking-library"
authors = company
pod("SnowplowTracker") {
version = "~> 1.2.0"
}
}

With credits to xoif as he answered this on youtrack. The problem seems to be xcode command line tools 13 and the solution is to downgrade:
Download Xcode 12.5
Select Xcode 12.5.1 as default Command Line Tool (in Xcode -> Preferences -> Locations)
cinterop should work again.

I think it has something to do with recent Xcode/toolchain update. I've got the same problem with other cocoapod that was compiling fine last week. I've just removed the pod for now, but probably if there's a way to downgrade xcode toolchain - it might help.

Im glad the xcode downgrade helped some of you. Some of the issues regarding Xcode 13 and Clang/cinterop will be supposedly fixed with Kotlin 1.6.0. However, the current preview (1.6.0-M1) still fails for me because of other issues. If I find a way to make my configuration run with kotlin 1.6.0 and Xcode 13, I'll let you know in this thread.

Related

Antivirus warning in kotlin-util-io-1.6.21

I'm learning Kotlin and Spring Boot and recently am running into an antivirus warning about a file called oneeva.a!ml while building my project and gradle downloads kotlin-util-io-1.6.21.jar
org.gradle.internal.resolve.ArtifactResolveException: Could not download kotlin-util-io-1.6.21.jar (org.jetbrains.kotlin:kotlin-util-io:1.6.21)
This happens when I try to build a new Spring Boot project. No one else online seems to have encountered this before. Does anyone have any guidance?
edit: This problem occurs when creating a new spring initializer build using Gradle but not on Maven.
edit 2022-05-14: New gradle projects are working fine now without any differences in configuration
I also got the same issue after creating a new project on Android Studio Bumblebee | 2021.1.1 Patch 3 . I tried manually downloading kotlin-util-io-1.6.21.jar but it is getting blocked on my Windows machine due to some virus detected. Downgrading to kotlin-util-io-1.6.20 worked for me.
Got it resolved by updating your Windows Defender database through Windows Update.
I just updated antivirus database to the latest version, works again.
See: https://youtrack.jetbrains.com/issue/KT-52297

Properly set up Java 9 as SDK in Intellij IDEA on Linux due to new folder structure

Before you write me off, please consider that neither of these are answers to my question:
How to setup SDK in IntelliJ IDEA?
How do I change the IntelliJ IDEA default JDK?
In IntelliJ IDEA 2017.2.6, attempting to add JDK9 as an SDK passes but does not work as the classpaths end up empty. Steps to reproduce:
Open 'Add new SDK dialog'
(go to Project Settings > Project > Project SDK > New > JDK)
Select JDK 9
Passes, but if you look under SDK > JDK9 classpaths are empty and your code errors out due to base classes not being found. See image:
In IntelliJ IDEA 2017.3 EAP you get an error about JDK classes not being found. See images below:
Open 'Add new SDK dialog'
(go to Project Settings > Project > Project SDK > New > JDK)
Select JDK 9
Should pass, but produces error popup
Command line compilation of HelloWorld example with jdk9 works as expected.
EDIT: Found an almost-duplicate: Intellij IDEA 2017.2 can't add openjk 9 on Linux Mint 18. Key differences:
Linux version: they're using Mint 18, and I'm using Debian Stretch.
OpenJDK is the latest from the repo at the moment of writing: 9~b181-4~bpo9+1. Even though is the same version, it still does not work in my case.
EDIT: Another possible duplicate: intellij idea does not see java 9 standard classes
I did not understand the answer from the comments though. Tried setting different names for JDK (9 and 1.9) but it still did not show modules instead of classpaths and classpaths remained empty.
Current debian binary package openjdk-9-jre-headless 9~b181-4 contains incorrectly compiled lib/jrt-fs.jar file.
There are 2 filed issues separately on both idea youtrack and also ubuntu launchpad.
As it is indicated here:
Probable reason:
Classes in lib/jrt-fs.jar were compiled by Java 9 with options "-source 8"/"target 8". They should be compiled with "--release 8" option instead (or by Java 8)
A temporary workaround may be replacing /usr/lib/jvm/java-9-openjdk-amd64/lib/jrt-fs.jar with the one from Oracle JDK.
You may also try to recompile the openjdk-9 source using the advised option "--release 8".
Anyway I advice to vote up this issue on the above link to attract more attention by dev team.
Use Oracle Java instead of OpenJDK for now. You can pull that in through WebUpd8's repository.
sudo add-apt-repository ppa:webupd8team/java &&
sudo apt-get update &&
sudo apt-get install oracle-java9-installer
It doesn't look like this is going to work with OpenJDK, so if you want to play with the latest and greatest Java, this is going to be the way to do it for now. Otherwise, from what I've seen, you've done this correctly and once this gets actually fixed, it will work just fine.

IntelliJ doesn't recognize flutter plugin

I wanted to try out flutter with IntelliJ, so I followed the order of https://flutter.io/setup-macos/ and everything worked out. But today, out of nowhere, it doesn't work anymore. I can run my code, but reload and hot reload is disabled. So I'd have to close and restart everything, every time, I'd like to see a change. "flutter doctor" tells me:
IntelliJ IDEA Ultimate Edition (version 2017.2.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
• Dart plugin version 172.4155.35
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins
But I looked it up, and flutter clearly was installed. I honestly sit here for 5 hours now, trying to figure it out, but I just can't find the problem. I deleted and reinstalled Flutter, Dart and IntelliJ like 4 times now, but it didn't work either.
Flutter in generall works, at least I can run the app in the terminal, so the problem got to be with IntelliJ. I also deleted the following folders:
macOS
~/Library/Application Support/IntelliJIdeaXX
~/Library/Preferences/IntelliJIdeaXX
~/Library/Caches/IntelliJIdeaXX
~/Library/Logs/IntelliJIdeaXX
Does anyone have an idea of what I can do now?
It was reported several times recently. master is the development branch with some newer code. alpha dev (default) is the recommended channel, but there are currently issues with dev which are already fixed in master. dev will be updated soon and it's recommended to switch back to dev when the fixes have landed.
flutter channel master
to switch back later
flutter channel alpha
flutter channel dev
In case somebody is still looking for an answer for this... Jetbrains has changed the plugins directory since the 2020.x versions (2019 - 2020)
Windows:
from: %HOMEPATH%\.\config\plugins
to: %APPDATA%\JetBrains\\plugins
MacOS:
from: ~/Library/Application Support/
to: ~/Library/Application Support/JetBrains//plugins
Linux:
from: ~/./config/plugins
to: ~/.local/share/JetBrains/
To fix the problem before a flutter update, I just created a symbolic link of my plugins directory (I use mac):
ln -s /Users/xxx/Library/Application\ Support/JetBrains/IntelliJIdea2020.1/plugins /Users/xxx/Library/Application\ Support/IntelliJIdea2020.1
That did the trick for me! I hope it helps others as well :)
Cheers.

IntelliJ IDEA 2016.2.5 false class error

After updating to latest IntelliJ 2016.2.5 (community), when I create new class that requires import of new library in class or some times when I have code errors, it shows a red line under the class name, but after fixing the error, the red line is still present but the class works fine.
Example in one of the scenarios I have had a working class I have previously worked on with jfree chart example, I have copied the class to my new project, and I added the org.jfree dependency in Maven, after updating maven, I was able to build and run the class with out problems, but it kept the red line.
When IntelliJ need to make mass error line updates, it does not refresh the red line even thus it is fixed.
Note:
This behavior doesn't happen for small error issues
This issue didn't occur in previous versions.
Rebuilding and cleaning project does not help.
My Solution right now is to restart IDE.
My Question is this a bug? Or is it some setting I have to do on this version?
Software info:
Build #IC-162.2228.15, built on October 14, 2016
JRE: 1.8.0_112-release-287-b2 x86
JVM: OpenJDK Server VM
On Windows 10 with latest updates
Here is example of the error:
Since I installed the latest version IntelliJ 2016.3 I have not faced this problem. So I assume this must be a bug that is solved on this version.

NullReferenceException Json.NET Xamarin.Android android 4.3

I believe I have just run into this bug https://bugzilla.xamarin.com/show_bug.cgi?id=4902 on my Nexus 4 now that I have updated to android 4.3.
Basically, when JSON.NET tries to get the timezone via the mono runtime, we get a null reference exception because there are issues with an environment variable in certain android builds.
The same code worked fine before I updated and still works fine on other android devices. Are there any workarounds available for this? Is there anything else I can do or am I stuck? Has anyone else run into it recently?
Is there a fix planned in the near future?
Xamarin 4.8.2 (alpha) fixes this problem. (As of Sep 3, 2013)